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
- What do you think about this tip? E-mail
Requires Free Membership to View
- us at editor@searchDatabase.com with your feedback.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical Oracle questions--or help out your peers by answering them--in our live discussion forums.
- Ask the Experts yourself: Our Oracle gurus are waiting to answer your toughest questions.
This was first published in May 2001

Join the conversationComment
Share
Comments
Results
Contribute to the conversation