Wednesday, September 24, 2014

Move partition table to different tablespace


This alter command allow you to move not partition table from one tablespace to another tablespace

ALTER TABLE [TABLE NAME to be moved] MOVE TABLESPACE [destination TABLESPACE NAME]


Move partition from one tablespace to another tablespace:

ALTER TABLE XXX MOVE PARTITION PARTITION_1 TABLESPACE YOUR_TABLESPACE;
ALTER TABLE  P_TRX_TEST MOVE PARTITION SYS_P26246 TABLESPACE TSP_DATATRX

If you are using subpartitions:

ALTER TABLE [TABLE NAME] MOVE SUBPARTITION [SUBPARTITION_NAME] TABLESPACE [NEW_TABLESPACE];

Default tablespace is a tablespace which is used when table was created. 
How to change default tablespace this way new partition will be created in requred tablespace?