Wednesday, April 28, 2010

Cloning/Duplicating controlfile between ASM diskgroups

Assume the following situation where there's only one controlfile for the whole DB.
SQL> show parameter control

NAME TYPE VALUE
------------- ------- ------------------------------
control_files string +FLASH/rac11g/controlfile/current.263.714060123

For obvious reasons it's not a good idea to run a DB with just one controlfile. To clone/duplicate the current controlfile to another diskgroup use the following steps.
Edit the spfile by specifying the new location of the controlfile
SQL> alter system set control_files='+FLASH/rac11g/controlfile/current.263.714060123',
'+DATA' scope=spfile sid='*';

Shutdown cleanly
SQL> shutdown immediate;
and
SQL> startup nomount
Use RMAN to restore the current controlfile to new location
RMAN> restore controlfile from '+FLASH/rac11g/controlfile/current.263.714060123';

Starting restore at 29-Apr-2010 00:32:33
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=141 instance=rac11g1 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+FLASH/rac11g/controlfile/current.263.714060123
output file name=+DATA/rac11g/controlfile/current.393.717553955
Finished restore at 29-Apr-2010 00:32:38
Start the DB and view spfile has the full location of the new controlfile
SQL> alter database mount;
SQL> show parameter control
NAME TYPE VALUE
------------- ------ ------------------------------
control_files string +FLASH/rac11g/controlfile/current.263.714060123,
+DATA/rac11g/controlfile/current.393.717553955
SQL> alter database open;