測試oracle子分割槽維護

wjlhappy發表於2008-07-22

今天忙中偷閒,簡單測試了一下一種子分割槽維護,以後抽空都測一下,測試結果如下:

1、建立子分割槽測試表

CREATE TABLE mylong
(YYYYMMDD DATE,
TYPE NUMBER,
cnt NUMBER
)
PARTITION BY RANGE(yyyymmdd)
SUBPARTITION BY list(TYPE)
SUBPARTITION TEMPLATE
(SUBPARTITION "type1" VALUES(1),
SUBPARTITION "type2" VALUES(2)
)
(PARTITION p20080701 VALUES less than (TO_DATE('20080702','yyyymmdd')),
PARTITION p20080702 VALUES less than (TO_DATE('20080703','yyyymmdd')),
PARTITION p20080703 VALUES less than (TO_DATE('20080704','yyyymmdd'))
);

檢視分割槽情況:
OWNER SEGMENT_TYPE SEGMENT_NAME PARTITION_NAME TABLESPACE_NAME SUMBLOCK
-------- ------------------ -------------------------------- -------------------- ------------------------- ----------
MCC TABLE SUBPARTITION MYLONG P20080701_type1 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080701_type2 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080702_type1 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080702_type2 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080703_type1 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080703_type2 TBS_MCC_DATA 1
----------
SUMALL 6

2、增加分割槽:

ALTER TABLE mylong ADD PARTITION p20080704 VALUES less than (TO_DATE('20080705','yyyymmdd'));

檢視分割槽情況
OWNER SEGMENT_TYPE SEGMENT_NAME PARTITION_NAME TABLESPACE_NAME SUMBLOCK
-------- ------------------ -------------------------------- -------------------- ------------------------- ----------
MCC TABLE SUBPARTITION MYLONG P20080701_type1 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080701_type2 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080702_type1 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080702_type2 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080703_type1 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080703_type2 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080704_type1 TBS_MCC_DATA 1
MCC TABLE SUBPARTITION MYLONG P20080704_type2 TBS_MCC_DATA 1
----------
SUMALL 8

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7553441/viewspace-1007651/,如需轉載,請註明出處,否則將追究法律責任。

相關文章