Monday, October 17, 2016

How to failover the Primary database to standby server and reinstate earlier primary database ?

How to manually failover the primary database to standby server in case primary server crashed/unavailable due to hardware issues?

Manual failover to standby 

Login to standby database and execute the below commands :

alter database recover managed standby database cancel;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH FORCE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WAIT WITH SESSION SHUTDOWN;
select to_char(standby_became_primary_scn) failover_scn from v$database;
set lines 200
select name,open_mode,database_role, protection_mode, protection_level, dataguard_broker from v$database;

Using DG broker

dgmgrl sys/password@tnsstring
failover to <standby db unique_name>
Show configuration verbose


How to reinstate the earlier primary as standby once the hardware issues resolved? (DB flashback mode is mandatory)

Bring back earlier primary as standby


Login to earlier primary database and execute  the below commands :

startup mount;
flashback database to scn <failover_scn which is derived from current primary>;
alter database convert to physical standby;
shutdown immediate;
startup mount;
alter database recover managed standby database using current logfile disconnect;


Using DG broker

Login to earlier primary database and execute  the below command
startup mount;

Using broker utility

dgmgrl sys/password@tnsstring
reinstate database <primary db unique name>
show configuration verbose



No comments:

Post a Comment