天天看點

oracle建立分區表權限不足,Oracle 建立分區表

-----建立表空間

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/,如需轉載,請注明出處,否則将追究法律責任。