SQL> alter table orders add
partition p_4 values less than (to_Date('2018/01/01','yyyy/mm/dd')),
partition p_5 values less than (to_Date('2019/01/01','yyyy/mm/dd'));
Statement Processed.
SQL> alter table orders split partition p_1 into (
partition p_1_1 values less than (to_date('2013/01/01','yyyy/mm/dd')),
partition p_1_2 values less than (to_date('2014/01/01','yyyy/mm/dd')),
partition p_1_3 );
Statement Processed.
SQL> select
table_name, partition_name, high_value, num_rows
from user_tab_partitions where table_name in ('ORDERS'); 2 3
TABLE_NAME PARTITION_NAME HIGH_VALUE NUM_ROWS
------------------------------ ------------------------------ -------------------------------------------------------------------------------- ----------
ORDERS P_1_1 TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_1_2 TO_DATE(' 2014-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_1_3 TO_DATE(' 2015-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_2 TO_DATE(' 2016-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA 9
ORDERS P_3 TO_DATE(' 2017-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA 55
ORDERS P_4 TO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_5 TO_DATE(' 2019-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
7 rows selected.
SQL> alter table orders add
partition p_4 values less than (to_Date('2018/01/01','yyyy/mm/dd')),
partition p_5 values less than (to_Date('2019/01/01','yyyy/mm/dd'))
ORA-14043: only one partition may be added
SQL> alter table orders split partition p_1 into (
partition p_1_1 values less than (to_date('2013/01/01','yyyy/mm/dd')),
partition p_1_2 values less than (to_date('2014/01/01','yyyy/mm/dd')),
partition p_1_3 )
ORA-14028: missing AT or VALUES keyword
SQL> alter table orders add
partition p_4 values less than (to_Date('2018/01/01','yyyy/mm/dd'));
Statement Processed.
SQL> alter table orders add
partition p_5 values less than (to_Date('2019/01/01','yyyy/mm/dd'));
Statement Processed.
SQL> alter table orders split partition p_1 at (to_date('2013/01/01','yyyy/mm/dd')) into (
partition p_1_1,
partition p_1_2
);
Statement Processed.
SQL> alter table orders split partition p_1_2 at (to_date('2014/01/01','yyyy/mm/dd')) into (
partition p_1_2,
partition p_1_3
);
Statement Processed.
SQL> select
table_name, partition_name, high_value, num_rows
from user_tab_partitions where table_name in ('ORDERS');
TABLE_NAME PARTITION_NAME HIGH_VALUE NUM_ROWS
------------------------------ ------------------------------ -------------------------------------------------------------------------------- ----------
ORDERS P_1_1 TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA 66187
ORDERS P_1_2 TO_DATE(' 2014-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_1_3 TO_DATE(' 2015-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_2 TO_DATE(' 2016-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA 12
ORDERS P_3 TO_DATE(' 2017-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA 20208
ORDERS P_4 TO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_5 TO_DATE(' 2019-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
7 rows selected.
SQL>
SQL> alter table orders merge partitions p_1_1, p_1_2, p_1_3 into partition p_1;
Statement Processed.
SQL> /
TABLE_NAME PARTITION_NAME HIGH_VALUE NUM_ROWS
------------------------------ ------------------------------ -------------------------------------------------------------------------------- ----------
ORDERS P_5 TO_DATE(' 2019-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_4 TO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
ORDERS P_3 TO_DATE(' 2017-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA 55
ORDERS P_2 TO_DATE(' 2016-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA 9
ORDERS P_1 TO_DATE(' 2015-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
SQL>
- 강좌 URL : http://www.gurubee.net/lecture/4263
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.