【實驗】【PARTITION】RANGE分割槽表合併分割槽
1.建立測試用range分割槽表
sec@ora10g> create table t_partition_range (id number,name varchar2(50))
2 partition by range(id)(
3 partition t_range_p1 values less than (10) tablespace tbs_part01,
4 partition t_range_p2 values less than (20) tablespace tbs_part02,
5 partition t_range_p3 values less than (30) tablespace tbs_part03,
6 partition t_range_pmax values less than (maxvalue) tablespace tbs_part04);
Table created.
2.查詢分割槽情況
sec@ora10g> col TABLE_NAME for a20
sec@ora10g> col partition_name for a20
sec@ora10g> col HIGH_VALUE for a10
sec@ora10g> col TABLESPACE_NAME for a15
sec@ora10g> select table_name,partition_name,high_value,tablespace_name from user_tab_partitions where table_name='T_PARTITION_RANGE' order by partition_position;
TABLE_NAME PARTITION_NAME HIGH_VALUE TABLESPACE_NAME
-------------------- -------------------- ---------- ---------------
T_PARTITION_RANGE T_RANGE_P1 10 TBS_PART01
T_PARTITION_RANGE T_RANGE_P2 20 TBS_PART02
T_PARTITION_RANGE T_RANGE_P3 30 TBS_PART03
T_PARTITION_RANGE T_RANGE_PMAX MAXVALUE TBS_PART04
3.每個分割槽各插入一條資料
sec@ora10g> insert into T_PARTITION_RANGE values (9,'secooler01');
1 row created.
sec@ora10g> insert into T_PARTITION_RANGE values (19,'secooler02');
1 row created.
sec@ora10g> insert into T_PARTITION_RANGE values (29,'secooler03');
1 row created.
sec@ora10g> insert into T_PARTITION_RANGE values (39,'secooler04');
1 row created.
sec@ora10g> commit;
Commit complete.
4.確認每個分割槽包含的資料
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_P1);
ID NAME
---------- --------------------------------------------------
9 secooler01
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_P2);
ID NAME
---------- --------------------------------------------------
19 secooler02
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_P3);
ID NAME
---------- --------------------------------------------------
29 secooler03
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_PMAX);
ID NAME
---------- --------------------------------------------------
39 secooler04
5.開始合併分割槽--將前兩個分割槽t_range_p1,t_range_p2合併到新分割槽t_range_pmerge中
sec@ora10g> alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_pmerge tablespace tbs_part04;
Table altered.
6.再一次確認分割槽情況和每一個分割槽記憶體放的資料
sec@ora10g> select table_name,partition_name,high_value,tablespace_name from user_tab_partitions where table_name='T_PARTITION_RANGE' order by partition_position;
TABLE_NAME PARTITION_NAME HIGH_VALUE TABLESPACE_NAME
-------------------- -------------------- ---------- ---------------
T_PARTITION_RANGE T_RANGE_PMERGE 20 TBS_PART04
T_PARTITION_RANGE T_RANGE_P3 30 TBS_PART03
T_PARTITION_RANGE T_RANGE_PMAX MAXVALUE TBS_PART04
sec@ora10g> select * from t_partition_range partition(T_RANGE_PMERGE);
ID NAME
---------- --------------------------------------------------
9 secooler01
19 secooler02
sec@ora10g> select * from t_partition_range partition(T_RANGE_P3);
ID NAME
---------- --------------------------------------------------
29 secooler03
sec@ora10g> select * from t_partition_range partition(T_RANGE_PMAX);
ID NAME
---------- --------------------------------------------------
39 secooler04
7.OK,合併分割槽成功
8.向低一級別的分割槽合併是不被允許的(較大的值不能插入到較小值分割槽中)
sec@ora10g> alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_p1;
alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_p1 tablespace tbs_part04
*
ERROR at line 1:
ORA-14275: cannot reuse lower-bound partition as resulting partition
9.向高一級別的分割槽合併沒有問題
sec@ora10g> alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_p2;
Table altered.
-- The End --
sec@ora10g> create table t_partition_range (id number,name varchar2(50))
2 partition by range(id)(
3 partition t_range_p1 values less than (10) tablespace tbs_part01,
4 partition t_range_p2 values less than (20) tablespace tbs_part02,
5 partition t_range_p3 values less than (30) tablespace tbs_part03,
6 partition t_range_pmax values less than (maxvalue) tablespace tbs_part04);
Table created.
2.查詢分割槽情況
sec@ora10g> col TABLE_NAME for a20
sec@ora10g> col partition_name for a20
sec@ora10g> col HIGH_VALUE for a10
sec@ora10g> col TABLESPACE_NAME for a15
sec@ora10g> select table_name,partition_name,high_value,tablespace_name from user_tab_partitions where table_name='T_PARTITION_RANGE' order by partition_position;
TABLE_NAME PARTITION_NAME HIGH_VALUE TABLESPACE_NAME
-------------------- -------------------- ---------- ---------------
T_PARTITION_RANGE T_RANGE_P1 10 TBS_PART01
T_PARTITION_RANGE T_RANGE_P2 20 TBS_PART02
T_PARTITION_RANGE T_RANGE_P3 30 TBS_PART03
T_PARTITION_RANGE T_RANGE_PMAX MAXVALUE TBS_PART04
3.每個分割槽各插入一條資料
sec@ora10g> insert into T_PARTITION_RANGE values (9,'secooler01');
1 row created.
sec@ora10g> insert into T_PARTITION_RANGE values (19,'secooler02');
1 row created.
sec@ora10g> insert into T_PARTITION_RANGE values (29,'secooler03');
1 row created.
sec@ora10g> insert into T_PARTITION_RANGE values (39,'secooler04');
1 row created.
sec@ora10g> commit;
Commit complete.
4.確認每個分割槽包含的資料
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_P1);
ID NAME
---------- --------------------------------------------------
9 secooler01
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_P2);
ID NAME
---------- --------------------------------------------------
19 secooler02
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_P3);
ID NAME
---------- --------------------------------------------------
29 secooler03
sec@ora10g> select * from T_PARTITION_RANGE partition(T_RANGE_PMAX);
ID NAME
---------- --------------------------------------------------
39 secooler04
5.開始合併分割槽--將前兩個分割槽t_range_p1,t_range_p2合併到新分割槽t_range_pmerge中
sec@ora10g> alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_pmerge tablespace tbs_part04;
Table altered.
6.再一次確認分割槽情況和每一個分割槽記憶體放的資料
sec@ora10g> select table_name,partition_name,high_value,tablespace_name from user_tab_partitions where table_name='T_PARTITION_RANGE' order by partition_position;
TABLE_NAME PARTITION_NAME HIGH_VALUE TABLESPACE_NAME
-------------------- -------------------- ---------- ---------------
T_PARTITION_RANGE T_RANGE_PMERGE 20 TBS_PART04
T_PARTITION_RANGE T_RANGE_P3 30 TBS_PART03
T_PARTITION_RANGE T_RANGE_PMAX MAXVALUE TBS_PART04
sec@ora10g> select * from t_partition_range partition(T_RANGE_PMERGE);
ID NAME
---------- --------------------------------------------------
9 secooler01
19 secooler02
sec@ora10g> select * from t_partition_range partition(T_RANGE_P3);
ID NAME
---------- --------------------------------------------------
29 secooler03
sec@ora10g> select * from t_partition_range partition(T_RANGE_PMAX);
ID NAME
---------- --------------------------------------------------
39 secooler04
7.OK,合併分割槽成功
8.向低一級別的分割槽合併是不被允許的(較大的值不能插入到較小值分割槽中)
sec@ora10g> alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_p1;
alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_p1 tablespace tbs_part04
*
ERROR at line 1:
ORA-14275: cannot reuse lower-bound partition as resulting partition
9.向高一級別的分割槽合併沒有問題
sec@ora10g> alter table t_partition_range merge partitions t_range_p1,t_range_p2 into partition t_range_p2;
Table altered.
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-609245/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【實驗】【PARTITION】RANGE分割槽表增加分割槽
- 【實驗】【PARTITION】RANGE分割槽表刪除分割槽
- 【實驗】【PARTITION】RANGE分割槽表截斷表分割槽(Truncate Partition)
- 【實驗】【PARTITION】RANGE分割槽表移動表分割槽(Move Partition)
- 【實驗】【PARTITION】RANGE分割槽表重新命名錶分割槽(Rename Partition)
- 【實驗】【PARTITION】RANGE分割槽建立
- 實驗】【PARTITION】RANGE分割槽建立【轉】
- 合併分割槽(coalesce partition)
- ORACLE 範圍分割槽 partition-range分割槽Oracle
- 【實驗】【PARTITION】RANGE分割槽表未指定maxvalue分割槽將無法插入相關資料
- 全面學習分割槽表及分割槽索引(11)--合併表分割槽索引
- 深入解析partition-range分割槽
- oracle composite partition組合分割槽_composite partition rangeOracle
- 全面學習分割槽表及分割槽索引(6)--建立range-list組合分割槽索引
- 分割槽表PARTITION table
- 深入學習分割槽表及分割槽索引(5)--建立range-hash組合分割槽(續)索引
- Oracle Interval Partition 自動分割槽表-實驗Oracle
- MySQL 分割槽表 partition線上修改分割槽欄位MySql
- 【實驗】【PARTITION】交換分割槽時分割槽表有主鍵目標表亦需有主鍵
- 分割槽Partition
- Oracle分割槽表(Partition Table)Oracle
- 分割槽表PARTITION table(轉)
- oracle分割槽partition及分割槽索引partition index(一)Oracle索引Index
- 【實驗】【PARTITION】exp匯出分割槽表資料
- MyISAM分割槽表遷移 && 合併
- 非分割槽錶轉換為分割槽表和partition indexIndex
- MySQL RANGE分割槽MySql
- Oracle分割槽表基礎運維-07增加分割槽(6RANGE_RANGE)Oracle運維
- partition 分割槽表重新命名
- oracle分割槽及分割槽索引partition_partition index_維護(一)Oracle索引Index
- oracle分割槽及分割槽索引partition_partition index_維護(二)Oracle索引Index
- oracle分割槽及分割槽索引partition_partition index_維護(三)Oracle索引Index
- oracle分割槽及分割槽索引partition_partition index_維護(四)Oracle索引Index
- win10怎麼合併分割槽_win10合併分割槽的方法Win10
- oracle分割槽表和分割槽表exchangeOracle
- oracle partition分割槽_分割槽列為空測試(一)Oracle
- mac分割槽合併APFS容器Mac
- MapReduce(三):分割槽、排序、合併排序