RMAN Recovery | Restore Controlfile

In this post, you will learn how to recover a database using RMAN. To recover database, an RMAN backup is required. In last article, it was explained that how we can take backup using RMAN. In following example, backup taken in last article will be used to perform full database recovery. Visit following link to view last article.

http://exploreoracle.com/2009/09/06/rman-script-to-take-full-database-backup/

Now we have scenario in which all data files have lost, we have also lost controlfiles. But some how, we haven’t lost archivelog files since last backup. In this case, we can recover our database using RMAN backup and archivelog files. We shall only lose data which was in current online redo log file. Remember, at startup our database in not opened.

Invoke RMAN and connect to database using following command.

RMAN> connect target /

Now set DBID with following command, it should be the Id of your database.

RMAN> set dbid=1216018526

Now start database in nomount stage.

RMAN> startup nomount;

Now configure controlfile autoback location.

RMAN> set controlfile autobackup format for device type disk to 'd:/rmanbackup/%F’;

Use following command to restore controlfiles.

RMAN> restore controlfile from autobackup;

Using this way all three control files will be restored to their default locations. However, there is another way to restore controlfile if you do not want to restore controlfile using “from autobackup”.  In this method,  first connect to database, and then start it in nomount stage.  Now locate the file name  which contains controlfile backup in d:\rmanbackup,  copy its  name.  Now issues following command to restore control file

RMAN> restore controlfile to ‘c:/CONTROL01.CTL’ from  ‘d:/rmanbackup/C-1216018526-20090905-00′;

In this command  ‘C-1216018526-20090905-00′ is name of backup file which contains controlfile backup. This file can be from autobackup or from  other backup. Other back means controlfile backup taken using “backup format” method in RMAN.

Above restore controlfile  command will create only one controlfile at ‘c:/CONTROL01.CTL’. Now copy this first control file at its location and save as it two times to create CONTROL02.CTL, and CONTROL03.CTL files.  using this method you do not need to set DBID, and autobackup control file location.

Restoration of control file is key point in database recovery. As control file has the information about all datafiles. Once control file is restored, database can be mounted.  Mounting of database is necessary.  All recovery operation can only be performed in mount stage. You can mount your database using following command.

RMAN> mount database;

After mounting database, this is time to restore all datafilese. To restore database, use following command.

RMAN> restore database using tag full_db;

Media Recovery should be performed on database before opening. In this step archivelogs are applied to recover data since last backup and to bring database in consistent stage.

RMAN> recover database;

Issue following command to open database and reset logs

RMAN> alter database open resetlogs;

Following snapshots show full recovery process.

Rman Recovery (part 1)

Rman Recovery (part 1)

Rman Recovery (part 2)

Rman Recovery (part 2)

Leave a Reply

Name and Email Address are required fields. Your email will not be published or shared with third parties.