Wednesday, November 4, 2009

How to move tablespace from one folder to another

This method only works for User created tablespaces. It does not require to shutdown your database.

If you need to move SYSTEM tablespaces, refer to link

In my example, I have 2 tablespaces named contm_data and contm_indx. They were created in Datapump folder by mistake. I had to move them one folder up.

Log in as SYS

Alter tablesapce contm_data offline;
Alter tablesapce contm_indx offline;

Manually copy/move the data files from old location ('E:\Oracle\OraData\PRODDB\DATAPUMP) to new location ('E:\Oracle\OraData\PRODDB)

alter tablespace contm_data rename datafile 'E:\Oracle\OraData\PRODDB\DATAPUMP\CONTM_DATA.DBF' to 'E:\Oracle\OraData\PRODDB\CONTM_DATA.DBF';

alter tablespace contm_indx rename datafile 'E:\Oracle\OraData\PRODDB\DATAPUMP\CONTM_INDX.DBF' to 'E:\Oracle\OraData\PRODDB\CONTM_INDX.DBF';

Alter tablesapce contm_data online;
Alter tablesapce contm_indx online;

No comments:

Post a Comment