In this article, I will show you how to move a table to another tablespace. Actually it is very simple to move table with just one command.
1 | ALTER TABLE test_table MOVE TABLESPACE new_tablespace; |
However, you must be careful on indexes and lobs. All the indexes on the table will be invalidated because of table moving. So you must rebuild all indexes on the table.
1 2 3 | ALTER INDEX index_name_on_test_table REBUILD; --or ALTER INDEX index_name_on_test_table REBUILD TABLESPACE new_tablespace;--if you want to change index tablespace |
If your table has lob columns, you must move them, too.
1 | ALTER TABLE test_table MOVE LOB (lob_column) STORE AS (TABLESPACE new_tablespace); |