DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Wednesday, August 26, 2015

Steps to recover a standby database from missing archive log files

Steps to perform for Rolling forward a standby database using RMAN incremental backup when primary and standby are not in sync and archives are deleted before applied it on standby:

1) On the standby database, stop the managed recovery process (MRP).
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

2) On the STANDBY DATABASE, find the SCN which will be used for the
incremental backup at the primary database:

SQL> SELECT CURRENT_SCN FROM V$DATABASE;
CURRENT_SCN
---------------------
3162298

3) In RMAN, connect to the PRIMARY database and create an incremental backup from
the SCN derived in the previous step:

RMAN>CONNECT TARGET SYS/********
RMAN> BACKUP INCREMENTAL FROM SCN 3162298 DATABASE FORMAT
'/tmp/ForStandby_%U' tag 'FORSTANDBY';

4) Take the backup of control file on primary database
sql > alter database create standby controlfile as '/tmp/control02.ctl' ;

4) Transfer all backup sets and controlfile backup created on the primary system to the
standby system.
scp /tmp/ForStandby_* standby:/tmp

5) Stutdown the standby database .
SQL>shutdown immediate

6) Take the backup of control files on standby database
$ mv control01.ctl control01.ctl.old
$ mv control02.ctl control02.ctl.old

Now put the controlfile copied from primary server to standby server in the controlfile location on standby database .

7)Mount the standby database using backup controlfile.
SQL>startup nomount;
SQL>alter database mount standby database;

8) Catalog the backupieces which you have copied from primary server to standby server
in step 4 into standby control file using below command on standby server .
RMAN> CATALOG START WITH '/tmp/ForStandby_';
using target database control file instead of recovery catalog
searching for all files that match the pattern /tmp/ForStandby
List of Files Unknown to the Database
=====================================
File Name: /tmp/ForStandby_2lkglss4_1_1
File Name: /tmp/ForStandby_2mkglst8_1_1
Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /tmp/ForStandby_2lkglss4_1_1
File Name: /tmp/ForStandby_2mkglst8_1_1

6) Recover the STANDBY database with the cataloged incremental backup:

RMAN> RECOVER DATABASE NOREDO;
starting recover at 23-SEP-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=28 devtype=DISK
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: +DATA/PROD/datafile/system.297.688213333
destination for restore of datafile 00002:
+DATA/PROD/datafile/undotbs1.268.688213335
destination for restore of datafile 00003: +DATA/PROD/datafile/sysaux.267.688213333
channel ORA_DISK_1: reading from backup piece /tmp/ForStandby_2lkglss4_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/tmp/ForStandby_2lkglss4_1_1 tag=FORSTANDBY
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished recover at 23-SEP-09

7) On the STANDBY database, start the MRP.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
DISCONNECT;

No comments: