Friday 20 July 2018

Failover to Standby Database with some log gap

Issue: Production database server crashed and missed couple of archives and not able to recover standby completely

Failover steps during incomplete recovery:
SQL> select INSTANCE_NAME,host_name,status,logins, to_char(STARTUP_TIME,'DD/MM/YYYY HH24:MI:SS') "STARTUP_TIME" from gv$instance;

INSTANCE_NAME HOST_NAME             STATUS       LOGINS        STARTUP_TIME
---------------- --------------- ------------ ---------- -------------------
proddb        jcraju.test.com       OPEN        ALLOWED         20/07/2018 23:45:34

SQL> select database_role,open_mode,name from gv$database;
DATABASE_ROLE   OPEN_MODE       NAME
---------------- -------------------- ---------
PHYSICAL STANDBY READ ONLY       PRODDB

SQL>!ping jcraju.prod.com
connect: Network is unreachable

SQL> recover standby database until cancel;
ORA-00279: change 1105887 generated at 07/17/2018 13:47:57 needed for thread 1
ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/STANDBY/archivelog/2018_07_20/o1_mf_1_33_%u_.arc
ORA-00280: change 1105887 for thread 1 is in sequence #33


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00308: cannot open archived log '/u01/app/oracle/flash_recovery_area/STANDBY/archivelog/2018_07_20/o1_mf_1_33_%u_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7

SQL> alter database recover managed standby database finish;
Database altered.

SQL> alter database activate standby database;
Database altered.

Monitor Alert log file:
Alert log:
alter database activate standby database
2018-07-20T23:57:29.481427-04:00
ALTER DATABASE ACTIVATE [PHYSICAL] STANDBY DATABASE [Process Id: 2833] (proddb)
2018-07-20T23:57:29.482278-04:00
Begin: Standby Redo Logfile archival
End: Standby Redo Logfile archival
Standby terminal recovery start SCN: 1105887
RESETLOGS after incomplete recovery UNTIL CHANGE 1105888 time 07/17/2018 13:47:57
Online log /u01/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_1_fntzyfp8_.log: Thread 1 Group 1 was previously cleared
Online log /u01/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_2_fntzyg85_.log: Thread 1 Group 2 was previously cleared
Online log /u01/app/oracle/flash_recovery_area/STANDBY/onlinelog/o1_mf_3_fntzygr4_.log: Thread 1 Group 3 was previously cleared
Standby became primary SCN: 1105886
2018-07-20T23:57:29.607784-04:00
Setting recovery target incarnation to 2
2018-07-20T23:57:29.625067-04:00
The Time Management Interface (TMI) is being enabled for role
transition information.  This will result in messages being
output to the alert log file with the prefix 'TMI: '.  This is
being enabled to make the timing of the various stages of the
role transition available for diagnostic purposes.  This
output will end when the role transition is complete.
Network throttle feature is disabled as mount time

AUDIT_TRAIL initialization parameter is changed back to its original value as specified in the parameter file.
ACTIVATE STANDBY: Complete - Database mounted as primary
Completed: alter database activate standby database

Database started in mount
SQL> select INSTANCE_NAME,host_name,status,logins, to_char(STARTUP_TIME,'DD/MM/YYYY HH24:MI:SS') "STARTUP_TIME" from gv$instance;

INSTANCE_NAME HOST_NAME        STATUS       LOGINS      STARTUP_TIME
-------------- ----------------- ------------ ---------- ---------------
proddb        jcraju.test.com   MOUNTED      ALLOWED    20/07/2018 23:45:34

SQL> select database_role,open_mode,name from gv$database;
DATABASE_ROLE   OPEN_MODE       NAME
---------------- -------------------- ---------
PRIMARY     MOUNTED         PRODDB

SQL> alter database open;
Database altered.

SQL>  select database_role,open_mode,name from gv$database;
DATABASE_ROLE   OPEN_MODE       NAME
---------------- -------------------- ---------
PRIMARY     READ WRITE           PRODDB

No comments:

Post a Comment