添加range表分區:
create table t_partition_range(id number,name varchar2(50)) partition by range (id)( partition t_range_p1 values less than (10) tablespace tbspart01, partition t_range_p2 values less than (20) tablespace tbspart02, partition t_range_p3 values less than (30) tablespace tbspart03 ); alter table t_partition_range add partition t_range_p4 values less than(40); 添加表hash分區的 alter table t_partition_hash add partition t_hash_p5 ; 查看分區表的status的狀態: select INDEX_NAME,PARTITION_NAME ,status from dba_ind_partitions where
index_name='IDX_PART_HASH_ID2'; SQL> select INDEX_NAME,PARTITION_NAME ,status from dba_ind_partitions where
index_name='IDX_PART_HASH_ID2'; INDEX_NAME PARTITION_NAME STATUS ------------------------------ ------------------------------ -------- IDX_PART_HASH_ID2 T_HASH_P1 USABLE IDX_PART_HASH_ID2 T_HASH_P2 USABLE IDX_PART_HASH_ID2 T_HASH_P3 USABLE IDX_PART_HASH_ID2 T_HASH_P4 USABLE IDX_PART_HASH_ID2 T_HASH_P5 USABLE 1 hash 分區和list分區的添加的語法一致,重新分配記錄到新的分區中去一味著將消耗一定的i/o的操作 2 如果沒有使用update indexes子句 range的global和local的索引將不受到影響 新加分區或者移動數據的分區的local和global的索引將置為
unuseable,需要重新的編譯。 收縮表分區(coalesce partitions) 只是針對hash分區和複合分區的hash子分區有效,一個一個收縮。 alter table t_partition_hash coalesce partition; 注意點同上
交换分区:
alter table tbname1 exchange partition/subpartition ptname with table tbname2;
合并分区:
alter table tbname merge partitions/subpartitions pt1,pt2 into partition/subpartition pt3;
修改分区:
Alter table tbname modify partition/subpartition ptname add values (v1,v2....vn);
spilt分区:
该命令的语法针对不同分区会有不同的形式,
l For range partition:alter table tbname split partition ptname at (value) into (partition newpt1 tbs_clause,partition newpt2 tbs_clause);
l For list partition : alter table tbname split partition ptname values (v1,v2...vn) into (partition newpt1 tbs_clause,partition newpt2 tbs_clause);