Trying to move table tab from tablespace oldTs to newTs. There is a composite partition (Range/Hash) on tab. Hence, a direct "Alter-Table-Move-Tablespace" query won't work, need to migrate partition by partition. Below is the SQL of tab:
CREATE TABLE tab
(
col_1 char(6),
col_2 varchar2(4),
col_3 varchar2(5)
)
TABLESPACE oldTs PARTITION BY RANGE
(
"col_1"
)
SUBPARTITION BY HASH
(
"col_2"
)
SUBPARTITIONS 1
(
PARTITION "P201102" VALUES LESS THAN ('201103') PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "oldTs" NOCOMPRESS NOLOGGING ( SUBPARTITION "SYS_SUBP5223" TABLESPACE "oldTs" NOCOMPRESS , SUBPARTITION "SYS_SUBP5224" TABLESPACE "oldTs" NOCOMPRESS ),
PARTITION "P201103" VALUES LESS THAN ('201104') PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "oldTs" NOCOMPRESS NOLOGGING ( SUBPARTITION "SYS_SUBP5225" TABLESPACE "oldTs" NOCOMPRESS , SUBPARTITION "SYS_SUBP5226" TABLESPACE "oldTs" NOCOMPRESS )
);
There are several such monthly partitions, created a procedure which acquires all the partition names (such as P201102, P2001103) and generates an alter query for moving partitions. For ex,
ALTER TABLE tab_name MOVE PARTITION P201102 TABLESPACE newTbs;
But, the query gives below error:
SQL Error: ORA-14257: cannot move partition other than a Range, List, System, or Hash partition
Also, if you notice in P201102/P201103, each has two sub-partitions (SYS_SUBP5225 & SYS_SUBP5226 for P201103).
Require the correct syntax of alter statement for migrating partitions for the above scenario.