Oracle 12c-Step by Step Manual Reinstate Failed Primary Database using Flashback
Description:-
- we need check the flashback is enabled on both primary and standby and flashback logs retention time has not exceeded
- If flashback is not enabled on both primary and standby then we need to recreate standby from begin.
Flashback Database
it is worth drawing your attention to Flashback Database once more. Although a switchover/switchback is safe for both the primary and standby database, a failover renders the original primary database useless for converting to a standby database. If flashback database is not enabled, the original primary must be scrapped and recreated as a standby database.
Using FLASHBACK to Reinstate the old primary as standby after FAILOVER activity
Dataguard Configuration:-
After failover activity,both database role become primary
Step:1 On the NEW PRIMARY issue this command to obtain the SCN to FLASHBACK the old primary(new standby)
SQL> select to_char(standby_became_primary_scn) from v$database;
Step:2 OLD PRIMARY,
Flashback the old primary and convert it to a physical standby
SQL> shutdown immediate;
SQL> startup mount;
Step:3
SQL> Flashback Database To Scn 2569953
Step:4
SQL> Alter Database Convert To Physical Standby;
Step:5
SQL> shutdown immediate;
SQL> startup
Step:6 Check the database role and database status
SQL> select name,open_mode,database_role from v$database;
Step :7 After reinstate,check the standby is sync
SELECT ARCH.THREAD# “Thread”, ARCH.SEQUENCE# “Last Sequence Received”, APPL.SEQUENCE# “Last Sequence Applied”, (ARCH.SEQUENCE# – APPL.SEQUENCE#) “Difference” FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;
After failover,reinstate the old primary as a standby.So the old primary database role becomes physical standby.
Post check status:-
Catch Me On:- Hariprasath Rajaram
LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/
Facebook:https://www.facebook.com/HariPrasathdba
FB Group:https://www.facebook.com/groups/894402327369506/
FB Page: https://www.facebook.com/dbahariprasath/?
Twitter: https://twitter.com/hariprasathdba