Thursday, March 13, 2008

Renaming / Moving Data Files, Control Files, and Online Redo Logs

http://www.idevelopment.info/data/Oracle/DBA_tips/Database_Administration/DBA_35.shtml

Only applies to datafiles whose tablespaces do not include SYSTEM, ROLLBACK or TEMPORARY segments

SQL> shutdown immediate
or SQL> alter tablespace INDX offline;

SQL> !mv /u05/app/oradata/ORA920/indx01.dbf /u06/app/oradata/ORA920/indx01.dbf

SQL> startup mount - if shutdown immediate was done

For both datafiles and redolog files:
SQL> alter database rename file '/u05/app/oradata/ORA920/indx01.dbf' to '/u06/app/oradata/ORA920/indx01.dbf';

Do not disconnect after this step. Stay logged in
and proceed to open the database!

SQL> alter database open;

SQL> exit



For renaming controlfiles,
1) Edit the control_files parameter in the init.ora file (create pfile from spfile; if running in spfile mode)
or : alter system set control_files='/oracle/control1.ctl','/oracle2/control2.ctl' scope=spfile;
2) Shutdown instance
3) OS move of controlfiles as required
4) Startup using pfile
STARTUP PFILE=C:\Oracle\Admin\SID\PFile\init.ora;

No comments: