分区表的应用
1:创建范围分区表;
2:导入原来的表;
create tablespace emp1
datafile 'D:appiloveyouoradatazhongguoemp1.dbf' size 50m;
create tablespace emp2
datafile 'D:appiloveyouoradatazhongguoemp2.dbf' size 50m;
create tablespace emp3
datafile 'D:appiloveyouoradatazhongguoemp3.dbf' size 50m;
create table emp
(empno number(4),
ename varchar2(30),
sal number)
partition by range(empno)
(partition e1 values less than (1000) tablespace emp1,
partition e2 values less than (2000) tablespace emp2,
partition e3 values less than (maxvalue) tablespace emp3);
insert into emp values (100,'Tom',1000);
insert into emp values (500,'Peter',2000);
insert into emp values (1000,'Scott',3000);
insert into emp values (1999,'Bill',4000);
insert into emp values (5000,'Gates',6000);
commit;
SQL> select * from emp
2 ;
EMPNO ENAME SAL
----- ------------------------------ ----------
100 Tom 1000
500 Peter 2000
1000 Scott 3000
1999 Bill 4000
5000 Gates 6000
SQL> select * from emp partition(e2);
EMPNO ENAME SAL
----- ------------------------------ ----------
1000 Scott 3000
1999 Bill 4000
SQL> select * from emp partition(e1);
EMPNO ENAME SAL
----- ------------------------------ ----------
100 Tom 1000
500 Peter 2000
SQL> select * from emp partition(e3);
EMPNO ENAME SAL
----- ------------------------------ ----------
5000 Gates 6000
SQL>
SQL> alter table emp truncate partition e1;
Table truncated
SQL> select * from emp partition (e1);
EMPNO ENAME SAL
----- ------------------------------ ----------
SQL>
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22934571/viewspace-1057991/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22934571/viewspace-1057991/