Recovery of control file: It is recommended that controlfiles should be protected by multiplexing of copies on different logical devices. If we lose all copies of the controlfile, it will be very difficult to recover it.
HOWEVER, if ALL COPIES of the current controlfile are lost, then
- Restore from backup
- Re-create
Restoring the controlfile is NECESSARY even if it has not been damaged when doing an incomplete recovery of the database to a point in time when the physical structure of the database was different from current.
Example: A tablespace has been dropped
Backup of control file:
In SQL backup as follows:
SQL> alter database backup controlfile to 'control_backup.bak';
Four ways RMAN can back up the controlfile:
RMAN> backup as copy current controlfile; --back up the controlfile as an image copy RMAN> backup as backupset current controlfile; --back up the controlfile in a backup set RMAN> backup tablespace MEREBATECH include current controlfile --included in a backup set RMAN> configure controlfile autobackup on; --RMAN makes automatic backup of controlfile and spfile
Restore Control file:
RMAN> restore controlfile from autobackup;
- can run command even with the database in nomount mode
- RMAN will go to the default location and attempt to locate the most recent autobackup
Two points to note:
- If only one database makes auto-backups to default destination then RMAN will automatically retrieve the most recent and restore it
RMAN> run { startup nomount; restore controlfile from autobackup; alter database mount; recover database; alter database open resetlogs;}
- If multiple databases share the same autobackup destination then provide the DBID so that RMAN can restore the correct controlfile.
SQL> select dbid from v$database; (assume this gives dbid of 1234567890)
RMAN> run { startup nomount; set dbid 1234567890; restore controlfile from autobackup; alter database mount; recover database; alter database open resetlogs;}