Sunday, September 25, 2011

Rename datafile

1. Put tablespace offline


sqlplus /nolog
SQL> conn admin_user/passwd
SQL> alter tablespace TBS offline normal;
SQL> exit


2. Copy or move datafile to new location using OS command cp


cd /u02/oradata/olcl
mv TBS_reorg0.dbf TBS.dbf


3. Change tablespace definition, renaming datafile


sqlplus /nolog
SQL> conn admin_user/passwd
SQL> alter tablespace TBS rename datafile '/u02/oradata/olcl/TBS_reorg0.dbf' to '/u02/oradata/olcl/TBS.dbf';


4. Put tablespace online


SQL> alter tablespace TBS online;
SQL> exit

No comments:

Post a Comment