DBAtlas · Database operations atlas

Split and merge partitions online

OraclePartitioning

Command

-- 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';

What it does

SPLIT divides a partition at a boundary value into two (12c+: into several); MERGE combines adjacent partitions. With ONLINE, DML continues during the operation; with UPDATE INDEXES, local and global indexes do not become UNUSABLE.

When to use it

To split a MAXVALUE/"other" partition that has grown, to merge small old partitions before archiving, or to change the partitioning scheme (monthly to quarterly).

Caution

Requires the Partitioning option (extra-cost EE); ONLINE requires Enterprise Edition. SPLIT/MERGE physically rewrites the data: slow on large partitions, generating redo/undo and temporary space. Without ONLINE the table is locked for DML during the operation; without UPDATE INDEXES global indexes become UNUSABLE. Splitting an empty partition is fast (fast split).

Open in DBAtlas →

Related