创建分区表
--分区表,范围分区 create table achievement( id number primary key, name varchar2(10), subject varchar2(10), score number) partition by range(score) ( partition part1 values less than(60) tablespace users, partition part2 values less than(80) tablespace users, partition part3 values less than(maxvalue) tablespace users ) insert into achievement values(3,'张天','Java',null); select * from achievement select * from achievement partition(part3); --全并分区 alter table achievement merge partitions part2,part3 into partition part4 select * from achievement partition(part4); --删除分区 alter table achievement drop partition part4 如果没有使用maxvalue 值,则可以给范围分区表增分区 alter table achievement add partition part5 values less than(120); 当新增加的分区取值没有超过现在分区的最大值,系统会提示出错误 --建立局部分区索引,各个分区索引之间是独立的 create index achievement_index on achievement (name) local ( partition index1 tablespace users, partition index2 tablespace users, partition index3 tablespace users ) --建立全局分区索引,各个分区索引之间不是独立的,分区索引和分区表之间也不是简单的一对一关系 create index achievement_global_index on achievement (score) global partition by range(score) ( partition part1 values less than(60) tablespace users, partition part2 values less than(80) tablespace users, partition part3 values less than(maxvalue) tablespace users, )