=====================
Overview
=====================
Oracle provides many ways to restore the controlfile for recovery using RMAN (Recovery Manager). This article provides several examples of how to get the controlfile back quickly so the restore of the database can occur.
If you do not specify the location where to restore the controlfile to, the parameter control_files is used with the respective names and locations listed in the parameter file (init.ora or spfile).
Several of the examples in this article make use the autobackup controlfile created by RMAN. By default, the format of the autobackup file for all configured devices is the substitution variable %F in the FORMAT clause. This variable format translates into c-IIIIIIIIII-YYYYMMDD-QQ, with the placeholders defined as follows:
IIIIIIIIII stands for the DBID.
YYYYMMDD is a time stamp of the day the backup is generated.
QQ is the hex sequence that starts with 00 and has a maximum of FF.
Example OMF autobackup controlfile:
o1_mf_s_716574721_5wn6p1hj_.bkp
=====================
Example
=====================
The following examples use Oracle Database 10g and make use of a Recovery Catalog and the Flash Recovery Area (FRA).
1. Restore controlfile from autobackup.
RMAN> restore controlfile from autobackup;
2. Restore controlfile from a specific backup piece.
RMAN> restore controlfile from '/backup_dir/piece_name';
3. Restore controlfile from most recent available controlfile backup.
RMAN> restore controlfile;
The following examples use Oracle Database 10g and do not require the use of a Recovery Catalog or a Flash Recovery Area (FRA). The big difference is the requirement to set the dbid of the database before executing restore with the instance in a nomount state.
4. The following backup used all defaults. If not using a FRA, this backup should be in $ORACLE_HOME/dbs.
RMAN> set dbid=nnnnnnnnn;
RMAN> restore controlfile from autobackup;
5. Restore from autobackup looks at the most recent 7 days backups by default. If you want to restore an autobackup that's older then the default you can use the 'maxdays' parameter..
RMAN> set dbid=nnnnnnnnn;
RMAN> restore controlfile from autobackup maxdays 20;
6. Restore from autobackup increasing the number of autobackup sequences looked for restore in case your database generated many autobackups in a given day.
RMAN> set dbid=nnnnnnnnn;
RMAN> restore controlfile from autobackup maxseq 10;
7. Restoring from autobackup when the backup location is not default.
C:\Documents and Settings\Administrator>rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jul 26 14:36:54 2011Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: PME (DBID=941578866)RMAN> set dbid=941578866;
RMAN> set controlfile autobackup format for device type disk to '/tmp/%F';
RMAN> restore controlfile from autobackup;
8. Restore the controlfile from this specific autobackup.
RMAN> set dbid=nnnnnnnnn;
RMAN> restore controlfile from '/tmp/c-1140771490-20080502-03';
9. Restore the controlfile from a specific autobackup file to a temporary disk location the replicate the temp controlfile to the respective locations and names given in control_files..
RMAN> set dbid=nnnnnnnnn;
RMAN> restore controlfile from '/tmp/c-1140771490-2008050203' to '/tmp/control.tmp';
RMAN> replicate controlfile from '/tmp/control.tmp'
Once you have the controlfile restored and mounted you have access to your previous backup configuration which will also be used during restore as well as the backup information required to restore and recover your database.
After you mount the controlfiles from Oracle101g 10.2.x > you can use the RESTORE PREVIEW command to see what backups will be required to restore and recover and what checkpoint you must exceed to open the database resetlogs.