Dividir e mesclar partições online
OracleParticionamentoComando
-- SPLIT: split a range partition in two, keep indexes usable
ALTER TABLE customer_app.sale_part
SPLIT PARTITION p2026_h2 AT (DATE '2026-10-01')
INTO (PARTITION p2026_q3, PARTITION p2026_q4)
UPDATE INDEXES ONLINE;
-- MERGE: merge two adjacent partitions
ALTER TABLE customer_app.sale_part
MERGE PARTITIONS p2026_q3, p2026_q4 INTO PARTITION p2026_h2
UPDATE INDEXES ONLINE;
-- ADD: new partition at the end (when there is no MAXVALUE)
ALTER TABLE customer_app.sale_part
ADD PARTITION p2027 VALUES LESS THAN (DATE '2028-01-01');
-- Check: partition bounds and UNUSABLE index partitions
SELECT partition_name, partition_position, high_value, num_rows
FROM dba_tab_partitions
WHERE table_owner = 'CUSTOMER_APP' AND table_name = 'SALE_PART'
ORDER BY partition_position;
SELECT index_name, partition_name, status
FROM dba_ind_partitions
WHERE index_owner = 'CUSTOMER_APP' AND status <> 'USABLE';O que faz
SPLIT divide uma partição em duas em um valor de limite (12c+: em várias); MERGE combina partições adjacentes. Com ONLINE, o DML continua durante a operação; com UPDATE INDEXES, os índices locais e globais não ficam UNUSABLE.
Quando usar
Para dividir uma partição MAXVALUE/"outros" que cresceu, mesclar partições antigas pequenas antes de arquivar ou mudar o esquema de particionamento (mensal para trimestral).
Atenção
Exige a opção Partitioning (EE com custo extra); ONLINE exige Enterprise Edition. SPLIT/MERGE reescreve fisicamente os dados: é lento em partições grandes e gera redo/undo e espaço temporário. Sem ONLINE a tabela fica bloqueada para DML durante a operação; sem UPDATE INDEXES os índices globais ficam UNUSABLE. Dividir uma partição vazia é rápido (fast split).