Move a table from one tablespace to another

There are a number of ways to move a table from one tablespace to another. Here is one way to try.

There are many ways to move a table from one tablespace to another. For example, you can create a duplicate table with dup_tab as select * from original_tab; drop the original table and rename the duplicate table as the original one.

The second option is exp table, drop it from the database and import it back. The third option (which is the one I am most interested in) is as follows.

Suppose you have a dept table in owner scott in the system tablespace and you want to move in Test tablespace.

connect as sys
ora816 SamSQL :> select table_name,tablespace_name from dba_tables where table_name='DEPT' and owner='SCOTT';

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
DEPT                           SYSTEM

Elapsed: 00:00:00.50

You want to move DEPT table from system to say test tablespace.

ora816 SamSQL :> connect scott/tiger
Connected.
ora816 SamSQL :> alter table DEPT move tablespace TEST;

Table altered.

Elapsed: 00:00:00.71

ora816 SamSQL :> connect
Enter user-name: sys
Enter password:
Connected.
ora816 SamSQL :> select table_name,tablespace_name from dba_tables where table_name='DEPT' and owner='SCOTT';

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
DEPT                           TEST

For More Information


This was first published in May 2001

Dig deeper on Oracle database design and architecture

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close