RMAN backup records are stored in the RMAN catalog and the control file. However, if an RMAN catalog is not used, then any recovery of the database will be reliant on the backup records stored within the control file. Given the control file makes up part of the database that is being restored and it is in itself stored in the backup, it can become difficult to restore the database especially if the control file is one of the files that has been lost. A "chicken and egg" situation can occur where you need to restore the control file, but to find out where the control file backups are you need the control file.
Therefore, when not using an RMAN catalog it is important that particular attention is taken in regards to control file backups. Part of the solution to this problem is making sure auto control file backups are switched on. This ensures that whenever any backups are taken an automatic and independent backup of the controlfile is also taken to a predefined location, normally a file system. This allows DBAs to get access to the control file outside of the standard RMAN backups. Furthermore, the control file backup is simply a copy of the controlfile and as such, can be manipulated using OS commands.
However, what happens if the SAN has been lost in its entirety and there is no backup of the control file on disk? Or where the control file is stored in ASM and the ASM disks have been lost?
At many sites, the control file backup is backed up to tape using backup software. One such backup tool is Netbackup which can be used in conjunction with RMAN to redirect or duplex auto control file backups to tape in addition to or instead of disk.
Now if the entire SAN gets corrupted or the ASM disks are lost, the control file backup can be recovered from tape using RMAN and Netbackup. The following guide shows how the control file can be recovered from Netbackup using RMAN when no local copy of the control file is available.
Identifing the Controlfile Backups in Netbackup
1. Logon to the Database server as Oracle
2. From the command prompt issue the following replacing client_server with the netbackup NB_ORA_CLIENT value.
- /opt/openv/netbackup/bin/bplist -t 4 -C client_server -R -l /
3. The following example output shows the controlfile autobackups as the first and last files
-rw-rw---- oracle dba 60555264 Jul 01 08:35 /c-4097466002-20120701-0c
-rw-rw---- oracle dba 262144 Jul 01 08:34 /rman_MYSID_010712_223410_arch_j3odkrdj_1_1_819621299
-rw-rw---- oracle dba 262144 Jul 01 08:34 /rman_MYSID_010712_223410_arch_j2odkrdj_1_1_819621299
-rw-rw---- oracle dba 4980736 Jul 01 08:34 /rman_MYSID_010712_223410_arch_j0odkrcq_1_1_819621274
-rw-rw---- oracle dba 8650752 Jul 01 08:34 /rman_MYSID_010712_223410_arch_iuodkrcq_1_1_819621274
-rw-rw---- oracle dba 262144 Jul 01 08:34 /rman_MYSID_010712_223410_arch_j1odkrcq_1_1_819621274
-rw-rw---- oracle dba 2097152 Jul 01 08:34 /rman_MYSID_010712_223410_arch_ivodkrcq_1_1_819621274
-rw-rw---- oracle dba 60555264 Jul 01 08:33 /c-4097466002-20120701-0b
NOTE Controlfile autobackups can be identified using the standard name generated by the RMAN %F tag.
The %F tag combines DBID, day, month, year and sequence into a unique and repeatable generated name.
This variable translates into c-IIIIIIIIII-YYYYMMDD-QQ, where:
- IIIIIIIIII stands for the DBID
- YYYYMMDD is a time stamp in the Gregorian calendar of the day the backup is generated
- QQ is the sequence in hexadecimal number that starts with 00 and has a maximum of 'FF' (256)
To Recover the spfile or controlfile
1. Depending on the version of Oracle a bug relating to memory may need to be worked around by setting ORA_RMAN_SGA_TARGET. At the time of writing this is know to be an issue on 18.104.22.168
- export ORA_RMAN_SGA_TARGET=500
2. Start the database in nomount mode. Oracle will create its own temporary parameter file.
- RMAN> startup nomount force
3. Restore the spfile from Netbackup.
allocate channel ch10 type 'SBT_TAPE' parms="ENV=(NB_ORA_CLIENT=myclient)" ;
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE to '%F';
restore controlfile from 'c-4097466002-20120701-0c';
3. Replace controlfile with spfile in the above RMAN blcok should you need to restore the spfile, as both the controlfile and spfile will be in the same backuppiece