Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move table from one tablespace to another in oracle 11g

I run oracle 11g and need to move table (tbl1) from one tablespace (tblspc1) to another (tblspc2). What is the easiest way to do that?

like image 383
user2698625 Avatar asked Aug 20 '13 05:08

user2698625


People also ask

How do you move tables from one tablespace to another tablespace?

The alter table move command moves rows down into un-used space and adjusts the HWM but does not adjust the segments extents, and the table size remains the same. The alter table move syntax also preserves the index and constraint definitions.

How do I move a table to a new tablespace?

You can move any table to new tablespace in Oracle with following command. ALTER TABLE MEHMET. SALIH MOVE TABLESPACE NEW_TABLESPACE_NAME; You can move lots of tables to the new tablespace with using generate move scripts.


1 Answers

Try this:-

ALTER TABLE <TABLE NAME to be moved> MOVE TABLESPACE <destination TABLESPACE NAME> 

Very nice suggestion from IVAN in comments so thought to add in my answer

Note: this will invalidate all table's indexes. So this command is usually followed by

alter index <owner>."<index_name>" rebuild; 
like image 64
Rahul Tripathi Avatar answered Oct 07 '22 17:10

Rahul Tripathi