Oracle Dataguard - Switchover & FailoverConsider tesprim and tesstand as primary and standby databases respectively. Connect to DGMGRL and issue below command On primary :dgmgrl sys/sys@tesprim1 DGMGRL> show configuration; DGMGRL> SWITCHOVER TO tesstand; Performing switchover NOW, please wait... Operation requires a connection to instance "tesstand" on database " tesstand? Connecting to instance " tesstand"... Connected. New primary database " tesstand " is opening... Operation requires startup of instance "tesprim1" on database "tesprim1" Starting instance "tesprim1"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "tesstand" DGMGRL> show configuration;Revert Back Using DGMGRL : Once you perform switchover, the original primary becomes standby and original standby becomes primary. At this point, our primary is tesstand and standby is tesprim1. Connect to current primary tesstand and switchover to current stnadby tesprim1 On current primary(tesstand) :dgmgrl sys/sys@tesstand DGMGRL> show configuration; DGMGRL> switchover to tesprim1; Performing switchover NOW, please wait... Operation requires a connection to instance "tesprim1" on database "tesprim1" Connecting to instance "tesprim1"... Connected. New primary database "tesprim1" is opening... Operation requires startup of instance "tesstand" on database "tesstand" Starting instance "tesstand"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "tesprim1" DGMGRL> show configuration; Data Guard Broker Failover :A failover is when you have lost primary database. It?s very simple to perform failover using data guard broker.Let us simulate failure. We will kill the PMON process at OS level on primary On primary [oracle@tesdb ~]$ ps -ef|grep pmon oracle 8839 1 0 15:30 ? 00:00:00 ora_pmon_tesprim1 oracle 17320 14012 0 16:42 pts/3 00:00:00 grep --color=auto pmon kill -9 16914 Failover to Standby :Connect to standby database tesstand (as primary crashed or not available) and failover to standby tesstand On Standby :dgmgrl sys/sys@tesstand DGMGRL> show configuration; DGMGRL> FAILOVER TO tespstand; Performing failover NOW, please wait... Failover succeeded, new primary is "tesstand" DGMGRL> show configuration;Rebuild Primary After Failover : Post failover, there are two methods of rebuilding your failed primary Method 1: Rebuild from scratch ?> RMAN duplicate Method 2: Flashback database ?> only if Flashback was enabled Reinstate failed primary: When you use data guard broker, with just one command, .the primary can be rebuilt. Start the failed primary server, in this case start tesprim1 serverOn current primary (tesstand): dgmgrl sys/sys@tesstand DGMGRL> show configuration; DGMGRL> reinstate database tesstand; Reinstating database "tesprim1", please wait... Operation requires shutdown of instance "tesprim1" on database "tesprim1" Shutting down instance "tesprim1"...ORA-01109: database not open Database dismounted.ORACLE instance shut down. Operation requires startup of instance "tesprim1" on database "tesprim1" Starting instance "tesprim1"...ORACLE instance started. Database mounted. Continuing to reinstate database "tesprim1" ... Reinstatement of database "tesprim1" succeeded Verify tesprim1 post reinstate: The best part is broker will automatically recover earlier failed primary tesprim1, mount the database and start MRP tooOn failed primary (tesprim1) : select name,open_mode from v$database; select process, status, sequence# from v$managed_standby; Switchover to get original configuration: At this stage, you can perform switchover to again get back original configurationOn current primary (tesstand) : dgmgrl sys/sys@tesstand DGMGRL> switchover to tesprim1; « Previous Next Topic » (Oracle Dataguard - DGMGRL) |