Monday, February 25, 2013

standby resync using incremental backup




To fix an issue like this , using an incremental backup is the simplest way .

I have the steps which were used to sync the standby.



Primary

CURRENT_SCN

--------------------

12736630810

Standby



CURRENT_SCN

--------------------

12356146282





1.Take an incremental backup from primary starting from current SCN of standby



RMAN> run {

2> allocate channel c1 type disk;

3> backup incremental from scn 12356146282 database;

4> }


2.copy the backup pieces stand by machine

3.Create a new control file for standby


alter database create standby controlfile as ‘/your/own/location/standbycontrolfile.name’


SQL> alter database create standby controlfile as '/remotebu/cntrlDB.dbf';

Database altered.







4.Copy this files to standby host:



SQL> !

DBserver:PRIMARY 1% scp /remotebu/cntrlDB.dbf DBstandby:/oracle/DBname/origlogA/cntrl/cntrlDB.dbf

cntrlDB.dbf 100%
*****************************************************************************************
242 MB 08:58

.



5.log Off completely from your PRIMARY machine


6.Shut down standby database



SQL> alter database recover managed standby database cancel;

Database altered.

SQL> shut immediate



7.rename existing controlfiles


mv /oracle/DB/origlogA/cntrl/cntrlDB.dbf /oracle/DB/origlogA/cntrl/cntrlDB.dbf_old

mv /oracle/DB/origlogB/cntrl/cntrlDB.dbf /oracle/DB/origlogB/cntrl/cntrlDB.dbf_old

mv /oracle/DB/112_64/dbs/cntrl/cntrlDB.dbf /oracle/DB/112_64/dbs/cntrl/cntrlDB.dbf_old



8.Copy the control file created to all standby controlfile location



cp /oracle/DB/origlogA/cntrl/cntrlDB.dbf /oracle/DB/origlogB/cntrl/cntrlDB.dbf

cp /oracle/DB/origlogA/cntrl/cntrlDB.dbf /oracle/DB/112_64/dbs/cntrl/cntrlDB.dbf





9.Mount your standby database



SQL> alter database mount standby database;



10. open a standby RMAN session



RMAN> catalog start with '/remotebu/DB/incr';



using target database control file instead of recovery catalog

searching for all files that match the pattern /remotebu/DB/incr



List of Files Unknown to the Database

=====================================

File Name: /remotebu/DB/incr/cntrlDB.dbf

File Name: /remotebu/DB/incr/forstandby_DB_72097_1_807213198_12_02_2013

File Name: /remotebu/DB/incr/forstandby_DB_72098_1_807213198_12_02_2013

.

.



Do you really want to catalog the above files (enter YES or NO)? YES

cataloging files...

cataloging done



List of Cataloged Files

=======================

File Name: /remotebu/DB/incr/cntrlDB.dbf

File Name: /remotebu/DB/incr/forstandby_DB_72097_1_807213198_12_02_2013

File Name: /remotebu/DB/incr/forstandby_DB_72098_1_807213198_12_02_2013

.

.



11.Recover standby database



RMAN> recover database;

Starting recover at 24-FEB-13

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=7 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=755 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=1507 device type=DISK

allocated channel: ORA_DISK_4

channel ORA_DISK_4: SID=2258 device type=DISK

channel ORA_DISK_1: starting incremental datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

destination for restore of datafile 00007: /oracle/DB/sapdata03/sr3700_20/sr3700.data20

destination for restore of datafile 00130: /oracle/DB/sapdata03/sr370_1/sr370.data1

destination for restore of datafile 00131: /oracle/DB/sapdata03/sr370_2/sr370.data2

destination for restore of datafile 00132: /oracle/DB/sapdata03/sr370_3/sr370.data3

destination for restore of datafile 00140: /oracle/DB/sapdata03/sr3700_6/sr3700.data6

destination for restore of datafile 00956: /oracle/DB/sapdata01/sr3_15/sr3.data15

destination for restore of datafile 00957: /oracle/DB/sapdata01/sr3_16/sr3.data16

destination for restore of datafile 00974: /oracle/DB/sapdata02/sr3_33/sr3.data33





Recovery will fail with error looking for last archivelog





Then go ahead and start the automated recovery and you are ALL SET 





PROCESS SEQUENCE# STATUS

--------- -------------------- ------------

ARCH 0 CONNECTED

ARCH 0 CONNECTED

ARCH 0 CONNECTED

ARCH 0 CONNECTED

RFS 33087 IDLE

RFS 0 IDLE

RFS 0 IDLE

RFS 0 IDLE

MRP0 33086 APPLYING_LOG



TAKE A LEVEL 0 BACKUP of STANDBY DATABASE IMMEDIATELY.


No comments:

Post a Comment