Thursday 18 September 2014

Recovery using RMAN backup when control file is lost

How to recover database when control file is lost using RMAN backup?

There are two ways we can recover the database when control file is lost:
1. Restore the control file and recover the database
2. Recreate the control file using backup control file and recover
Note: please follow http://orcl11gdba.blogspot.in/2014/09/recovery-using-rman-backup-when-control_18.html for this method

DB Name: TESTDB
Here we shall perform first way to recover the database.

[oracle@avalance_testserv oradata]$ ls
control.ctl  dbf  redo
[oracle@avalance_testserv oradata]$ rm control.ctl
[oracle@avalance_testserv oradata]$ ls
dbf  redo
Note: Now I lost my control file.

[oracle@avalance_testserv oradata]$ sqlplus / as sysdba
SQL> shut abort
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
SQL> exit
Observation: we are putting the database in nomount state because we can’t directly mount it without control file.to do that we have to restore it from backup as below.

[oracle@avalance_testserv oradata]$ rman target/

RMAN> restore controlfile from '/u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/ORA_rman_ctrl_backup_TESTDB_0cpiqqu4_1_1.bck';

Starting restore at 18-SEP-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=99 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/TESTDB/oradata/control.ctl
Finished restore at 18-SEP-14

Observation: Now got our control file from backup. So we can mount  the database.

SQL> alter database mount;
Database altered.

Let’s perform recovery operation inorder to make controlfile SCN is  updated with same as that of for DB files.

RMAN> recover database ;

Starting recover at 18-SEP-14
Starting implicit crosscheck backup at 18-SEP-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=98 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 18-SEP-14

Starting implicit crosscheck copy at 18-SEP-14
using channel ORA_DISK_1
Finished implicit crosscheck copy at 18-SEP-14

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/ORA_rman_arch_backup_TESTDB_0lpiqjtc_1_1.bck
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/2014_09_18/o1_mf_annnn_TAG20140918T160603_b1ofdmh1_.bkp
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/2014_09_18/o1_mf_annnn_TAG20140918T160603_b1ofdos2_.bkp
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/2014_09_18/o1_mf_annnn_TAG20140918T160603_b1ofdnmr_.bkp
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/ORA_rman_ctrl_backup_TESTDB_0cpiqqu4_1_1.bck
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/ORA_rman_full_backup_TESTDB_0jpiqjsh_1_1.bck
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/backupset/ORA_rman_ctrl_backup_TESTDB_0mpiqjtd_1_1.bck
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_16/o1_mf_1_7_b1hm73wc_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_12/o1_mf_1_17_b1556v45_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_12/o1_mf_1_18_b1556v4m_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_12/o1_mf_1_16_b154d54v_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_12/o1_mf_1_15_b1543l1h_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_12/o1_mf_1_16_b1556v3m_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_12/o1_mf_1_17_b154d62h_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_12/o1_mf_1_14_b1543l02_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_15/o1_mf_1_6_b1fhgrbg_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/archivelog/2014_09_15/o1_mf_1_5_b1ffrfmz_.arc
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/autobackup/2014_09_18/o1_mf_n_858607535_b1o6bqs3_.bkp
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/autobackup/2014_09_18/o1_mf_n_858607530_b1o6blp5_.bkp
File Name: /u01/app/oracle/TESTDB/flash_recovery_area/TESTDB/autobackup/2014_09_18/o1_mf_n_858610716_b1o9g4rp_.bkp

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 5 is already on disk as file /u01/app/oracle/TESTDB/oradata/dbf/redo02.log
archived log for thread 1 with sequence 6 is already on disk as file /u01/app/oracle/TESTDB/oradata/dbf/redo03.log
archived log file name=/u01/app/oracle/TESTDB/oradata/dbf/redo02.log thread=1 sequence=5
archived log file name=/u01/app/oracle/TESTDB/oradata/dbf/redo03.log thread=1 sequence=6
media recovery complete, elapsed time: 00:00:00
Finished recover at 18-SEP-14

Recovery is completed all the archived logs and transactions are applied.

[oracle@avalance_testserv oradata]$  sqlplus / as sysdba


SQL> alter database open resetlogs;

Database altered.


It is suggested to take RMAN backup immediately after the activity is over. please follow the link to take RMAN backup: http://orcl11gdba.blogspot.in/2014/05/taking-database-backup-using-rman-method.html


Cheers…!!!


No comments:

ORA-600 [kwqitnmphe:ltbagi], [1], [0] reported in the alert log file.

ORA-00600 [kwqitnmphe:ltbagi] Cause: This issue arises in 12.1.0.2. The error occurs because there are still Historical Messages without...