Tuesday, August 12, 2008

How to Move Control file in Oracle ASM

1. First get the current control file names

SQL>select name from v$controlfile;

+CMP_PRE_DATA/cmpbt02q/control01.ctl.

2. Next we need to create a pfile

create pfile='/app/oracle/initCMPBT02Q.ora' from spfile;

3. shutdown the database but don't mount it
srvctl stop database -d CMPBT02Q
export ORACLE_SID=CMPBT02Q1
sqlplus / as sysdba
startup nomount
exit


4. Use RMAN to create a copy of the control file into the new diskgroup.

RMAN>rman target /restore controlfile to '+CMP_PRE_REDO' from '+CMP_PRE_DATA/cmpbt02q/control03.ctl';

5. Modify the initCMPBT02Q.ora file with the new control file, which can be obtained from the ASM +CMP_PRE_REDO/CMPBT02Q/CONTROLFILE location. Place this name in the pfile.

6. Shutdown the database immediate shutdown immediate
SQL>shutdown immediate;

7. Mount the database with the modified pfile.
SQL>startup pfile='/app/oracle/initCMPBT02Q.ora'

8. Create the spfile
SQL>create spfile='+CMP_PRE_DATA/CMPBT02Q/spfileCMPBT02Q.ora' from pfile='/app/oracle/initCMPBT02Q.ora';

9. Check you have the new control file location.
SQL>select name from v$controlfile
SQL> set wrap off
SQL> select name from v$controlfile;


NAME-------------------------------------------------------
+CMP_PRE_DATA/cmpbt02q/control01.ctl
+CMP_PRE_REDO/cmpbt02q/current.290.650448573
+CMP_PRE_DATA/cmpbt02q/control03.ctl

10. Start database services

No comments: