Tuesday, March 12, 2013

Using RMAN Incremental Backups to Roll Forward a Physical Standby Database

In this article, we will show the steps that can be used to resolve problems if a physical standby database has lost or corrupted archived redo data or has an unresolvable archive gap.



1). Check the CURRENT_SCN on Primary and Standby

--On Primary
SQL> select current_scn from v$database;

CURRENT_SCN
-----------
     871303

--On Standby
SQL> select current_scn from v$database;

CURRENT_SCN
-----------
     859798

2). On the standby database, stop the Managed Recovery Process.
SQL> alter database recover managed standby database cancel;

3). Take "FROM SCN" backup of Primary Database
RMAN> backup incremental from scn 859790 database format '/u01/stnd_backp_%U.bak';

4). Create Standby Controlfile at Primary:
SQL> alter database create standby controlfile as /u01/stnd_cntl.ctl';

5).Copy the backup files and control file to standby server.

scp oracle@192.168.195.128:/u01/stnd* /u01/

At Standby copy controlfiles to their loactaion:

cp stnd_cntl.ctl /u01/app/oracle/oradata/HCLDB/control01.ctl
cp stnd_cntl.ctl /u01/app/oracle/flash_recovery_area/HCLDB/control02.ctl

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

7).Catalog the backupieces which you have copied from primary server to standby server using below command on standby server.

RMAN> catalog start with '/u01/stnd_backp_0fo4apn7_1_1.bak';
RMAN> catalog start with '/u01/stnd_backp_0go4apov_1_1.bak';

8). Recover the standby database with the cataloged incremental backup.
RMAN> recover database noredo;

**You must also specify NOREDO if the online logs are available but the redo cannot be applied to the incrementals.
**If you do not specify NOREDO, then RMAN searches for redo logs after applying the incremental backup, and issues an error message when it does not find them.

9), Now check whether the standby database is properly synched or not
- On Primary database
SQL> select max(sequence#) from v$archived_log;

- On Standby database
SQL> select max(sequence#) from v$log_history;

10) On the standby database, start the MRP process.
SQL> alter database recover managed standby database disconnect from session;

No comments:

Post a Comment