删除分区:alter table[tablename] drop partition[ptname];
删除子分区:alter table[tablename] drop subpartition[ptname];
例:
--删除default分区
SQL> alter table t_partition_list drop partition t_list_default;
表已更改。
SQL> select partition_name,high_value,tablespace_name from user_tab_partitions
2 where table_name='T_PARTITION_LIST';
PARTITION_NAME HIGH_VALUE TABLESPACE_NAME
------------------------------ ---------------------------------------------------------------------
T_LIST_P1 1, 3, 5, 7, 9 TBS01
T_LIST_P2 2, 4, 6, 8, 10 TBS02
T_LIST_P3 21, 23, 25, 27, 29 TBS03
T_LIST_P4 20, 22, 24 TBS03
--添加default分区
SQL> alter table t_partition_list add partition t_list_default values(default) tablespace tbs03;
表已更改。
3.4、合并表分区(merge partitions)
语法: alter table tbname merge partitions/subpartitions pt1,pt2 into partition/subpartition pt3;
例:
SQL> select partition_name,high_value,tablespace_name from user_tab_partitions
2 where table_name='T_PARTITION_LIST';
PARTITION_NAME HIGH_VALUE TABLESPACE_NAME
------------------------------ ---------------------------------------------------------------------
T_LIST_DEFAULT default TBS03
T_LIST_P1 1, 3, 5, 7, 9 TBS01
T_LIST_P2 2, 4, 6, 8, 10 TBS02
T_LIST_P3 21, 23, 25, 27, 29 TBS03
T_LIST_P4 20, 22, 24 TBS03
SQL> alter table t_partition_list merge partitions t_list_p4,t_list_default into partition t_list_de fault;
表已更改。
SQL> select partition_name,high_value,tablespace_name from user_tab_partitions
2 where table_name='T_PARTITION_LIST';
PARTITION_NAME HIGH_VALUE TABLESPACE_NAME
------------------------------ ---------------------------------------------------------------------
T_LIST_DEFAULT default JJJG
T_LIST_P1 1, 3, 5, 7, 9 TBS01
T_LIST_P2