miercuri, 16 septembrie 2015

Recover a standby database from archived logs gap (ORA-16783: cannot resolve gap for database ....)

First, identify de SCN where the standby has lost the pace


 select current_scn from gv$database;

 CURRENT_SCN
-----------
 2320214727



Of course, the SCN of the primary database is higher and the gap could be pretty big.


dgmgrl
 
DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys
Password:
Connected.
DGMGRL> show configuration;
Configuration - DGC
  Protection Mode: MaxAvailability
  Databases:
    primary - Primary database
      Error: ORA-16810: multiple errors or warnings detected for the database
     - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR

DGMGRL> edit database 'standby' set state='APPLY-OFF';


on the primary:

rman target /              

RMAN> run
2> {
3> allocate channel ch1 type disk;
4> allocate channel ch2 type disk;
5> backup incremental from scn 2320214726 database format '/home/oracle/standby_%d_%t_%c_%p';
6> }

copy the backup pieces on the standby file system

on the standby:

RMAN> catalog start with '/home/oracle/bkp';

(of course, be careful with the locations, use your own instead of ....)


RMAN> run
2> {
3> allocate channel ch1 type disk;
4> recover database noredo;
5> }
 on the primary:


SQL> alter database create standby controlfile as '/home/oracle/bkp/standby.ctl';
Database altered.

copy the controlfile on the standby

stop the standby database, doesn't matter how

start it nomount

on the standby:

rman target /
RMAN> restore controlfile from '/home/oracle/bkp/standby.ctl';


alter database mount

RMAN> CATALOG START WITH '+standby_DATA1/standby/DATAFILE/';

RMAN> SWITCH DATABASE TO COPY;


SQL> ALTER DATABASE CLEAR LOGFILE GROUP 1;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 2;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 3;
SQL> ALTER DATABASE CLEAR LOGFILE GROUP 4;
....



$ dgmgrl    
DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys
Password:
Connected.
DGMGRL> edit database 'standby' set state='APPLY-ON';
Succeeded.

sqlplus / as sysdba

> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE  THROUGH ALL SWITCHOVER DISCONNECT  USING CURRENT LOGFILE

Now everything should be ok

Niciun comentariu:

Trimiteți un comentariu