RMAN - How to restore the controlfile using RMAN [ID 580414.1] | |||||
| |||||
Modified 10-JUN-2010 Type HOWTO Status PUBLISHED |
In this Document
Goal
Solution
Applies to:
Oracle Server - Enterprise Edition - Version: 9.2.0.1 to 11.1.0.6 - Release: 9.2 to 11.1
Oracle Server - Personal Edition - Version: 9.2.0.1 to 11.1.0.6 [Release: 9.2 to 11.1]
Oracle Server - Standard Edition - Version: 9.2.0.1 to 11.1.0.6 [Release: 9.2 to 11.1]
Information in this document applies to any platform.
Goal
There are many ways to restore the controlfile for recovery using RMAN. This note provides several examples of how to get the controlfile back quickly so the restore of the database can be started asap.
Configuring the Control File Autobackup Format
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.
Solution
Restoring the Controlfile using RMAN backups using a Recovery Catalog and the Flash Recovery Area.
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;
RMAN commands without using the Flash Recovery Area or Recovery Catalog. 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 backup used all defaults, This backup should be in $ORACLE_HOME/dbs.
RMAN> set dbid=xxxxxxxxx;
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=xxxxxxxxx;
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> restore controlfile from autobackup maxseq 10;
7. Restoring from autobackup when the backup location is not default.
RMAN> set dbid=xxxxxxxxx;
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=xxxxxxxxx;
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=xxxxxxxxx;
RMAN> restore controlfile from
'/tmp/c-1140771490-2008050203'
to '/tmp/control.tmp';
RMAN> replicate controlfile from '/tmp/control.tmp';
As you can see there are many ways to get the controlfile from backup onto disk for use. 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.