Thursday 20 March 2014

Recovering database when control file is lost


Recovering  database when  control file is lost:


For this we can do recovery in 2 methods
1. We can use our database backup taken in  /u01/oracle/app/oradata/pavan/database_1/HOT_BKP/ path.
2. Recreating control file.

METHOD-1
1. shut down the database.
    SQL> SHUT ABORT

2. Now copy the files from backup location to datafiles location. This is restoration of database  
cp   /u01/oracle/app/oradata/pavan/database_1/HOT_BKP/* /u01/oracle/app/oradata/pavan/database_1/

3. Start the database in mount state
    SQL>STARTUP MOUNT

4. Now we shall be doing recovery operation
SQL>RECOVER    DATABASE UNTIL CANCEL;

In this process it will start applying all available archivelogs to the database and recovers it. We need to cancel once all archive logs are applied.Enter cancel for cancelling the operation. Or else we can give AUTO to apply all archive logs  

5. Bring up the database in open mode with resetlogs
SQL>ALTER DATABASE OPEN RESETLOGS;
SQL> SELECT STATUS FROM V$INSTANCE;

METHOD-2:
Create a new control file using trace of backup control file and restart the database;
SQL>alter database backup controlfile to trace as ‘/tmp/control.sql’;
SQL>SHUT ABORT
SQL>@/ tmp/control.sql;
SQL>RECOVER    DATABASE UNTIL CANCEL;
SQL>ALTER DATABASE OPEN;


Note:Between the 2 mentioned methods 2nd one is preferable as it takes very less downtime compared to 1st method.

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...