2.5 在线重定义为分区表
ALTER TABLE owner.table_name
MODIFY
--PARTITION BY range (CHANGE_TIME)
PARTITION BY RANGE (CREATED_ON)
INTERVAL ( NUMTOYMINTERVAL (1, 'year') ) --interval(numtoyminterval(1,'month'))
(
PARTITION p2019
VALUES LESS THAN (TO_DATE ('2020-01-01', 'YYYY-MM-DD')),
PARTITION p2020
VALUES LESS THAN (TO_DATE ('2021-01-01', 'YYYY-MM-DD')),
PARTITION p2021
VALUES LESS THAN (TO_DATE ('2022-01-01', 'YYYY-MM-DD')),
PARTITION p2022
VALUES LESS THAN (TO_DATE ('2023-01-01', 'YYYY-MM-DD')),
PARTITION p2023
VALUES LESS THAN (TO_DATE ('2024-01-01', 'YYYY-MM-DD')),
PARTITION p2024
VALUES LESS THAN (TO_DATE ('2025-01-01', 'YYYY-MM-DD'))
)
ONLINE
UPDATE INDEXES; --此处如果没有指定索引为本地分区索引,在表分区完成后要进行索引重建