-----创建表空间
create tablespace myTableSpace_1 datafile 'C:/oracle/product/10.1.0/oradata/mydata/myTableSpace1.dbf'
size 100m extent management local uniform size 256K
create tablespace myTableSpace_2 datafile 'C:/oracle/product/10.1.0/oradata/mydata/myTableSpace2.dbf'
size 100m extent management local uniform size 256K
create tablespace myTableSpace_3 datafile 'C:/oracle/product/10.1.0/oradata/mydata/myTableSpace3.dbf'
size 100m extent management local uniform size 256K
-----创建分区
create table MyTest
(
id number,
name nvarchar2(100)
)
partition by range(id)
(
partition T1 values less than (100) tablespace myTableSpace_1,
partition T2 values less than (1000) tablespace myTableSpace_2,
partition T3 values less than (maxvalue) tablespace myTableSpace_3)
-----设置表可以修改
alter table mytest2 enable row movement;
-----给分区表插入数据
insert into MyTest values (10,'f1111');
insert into MyTest values (20,'f1112');
insert into MyTest values (100,'f1112');
insert into MyTest values (200,'f1112');
insert into MyTest values (1001,'f1112');
commit;
------查询分区表
select * from MyTest
select * from myTest partition(T1);
select * from myTest partition(T2);
select * from myTest partition(T3);
------?删除一个有表分区,同时些表分区的数据也将删除
ALTER TABLE myTest DROP PARTITION T3;
------ 插入一个表分区,插入时必须是在最大的表分区住下插入
alter table myTest add partition T3 values less than (10000) tablespace myTableSpace_3;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/345618/viewspace-1329685/,如需转载,请注明出处,否则将追究法律责任。