If you are missing one control file, and you have multiple copies, then you can shut down your database and simply restore the missing or damaged control file by copying a good control file to the correct location and name of the missing control file (see Chapter 2 for details).
Listed next are three typical scenarios when restoring a control file:
- Using a recovery catalog
- Using an autobackup
- Specifying a backup file name
Using a Recovery Catalog
When you’re connected to the recovery catalog, you can view backup information about your control files even while your target database is in nomount mode. To list backups of your control files, use the LIST command, as shown:
$ rman target / catalog rcat/foo@rcat
RMAN> startup nomount;
RMAN> list backup of controlfile;
If you’re missing all your control files, and you’re using a recovery catalog, then issue the STARTUP NOMOUNT and the RESTORE CONTROLFILE commands:
RMAN> startup nomount;
RMAN> restore controlfile;
RMAN restores the control files to the location defined by your CONTROL_FILES initialization parameter. You should see a message indicating that your control files have been successfully copied back from an RMAN backup piece. You can now alter your database into mount mode and perform any additional restore and recovery commands required for your database.
Note When you restore a control file from a backup, you’re required to perform media recovery on your entire database and open your database with the OPEN RESETLOGS command, even if you didn’t restore any data files. You can determine whether your control file is a backup by querying the CONTROLFILE_TYPE column of the V$DATABASE view.
Using an Autobackup
When you enable the autobackup of your control file and are using an FRA, restoring your control file is fairly simple. First, connect to your target database, then issue a STARTUP NOMOUNT command, followed by the RESTORE CONTROLFILE FROM AUTOBACKUP command, like this:
$ rman target /
RMAN> startup nomount;
RMAN> restore controlfile from autobackup;
RMAN restores the control files to the location defined by your CONTROL_FILES initialization parameter. You should see a message indicating that your control files have been successfully copied back from an RMAN backup piece. Here is a snippet of the output:
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
You can now alter your database into mount mode and perform any additional restore and recovery commands required for your database.
When restoring a database to a different server, these are generally the first few steps in the process take a backup of the target database, copy to the remote server, and then restore the control file from the RMAN backup. In these scenarios, I usually know the name of the backup piece that contains the control file. Here is an example in which you instruct RMAN to restore a control file from a specific backup piece file:
RMAN> startup nomount;
RMAN> restore controlfile from
'/u01/O12C/rman/rman_ctl_c-3423216220-20130113-01.bk';
The control file will be restored to the location defined by the CONTROL_FILES initialization parameter.