The Data Guard Command Line Interface can be used to manage your Data Guard environment through the command line. Using the Data Guard Command Line Interface, dgmgrl
, you can manage the broker configuration along with the configurations of the databases configured in the broker.
This document will detail a switchover using the Data Guard Command Line Interface. If you would like to see the steps for switchover using a manual method see the post Data Guard Switchover to a Physical Standby. For information on performing a switchover using Oracle Enterprise Manager see the post Switchover to a Physical Standby using Oracle Enterprise Manager 11gR1 Grid Control
Switchover Process
During the switchover to a physical standby the broker performs the following:
1. Verifies that the primary is enabled and is in the TRANSPORT-ON state and that the target standby database is enabled and is in the APPLY-ON state.
2. Shuts down all instances on the primary except for one if needed. No instances will be shutdown on the target physical standby.
3. The primary database is first transitioned to the standby role then the original standby is transitioned to the primary role.
4. The broker configuration file is updated to reflect the change in roles.
5. Restarts the new standby database and begins the redo apply service.
6. The new primary database is opened in read/wirte mode and the redo transport service is started.
Below we connect to primary database using dgmgrl
and display the configuration.
[oracle@prod ~]$ dgmgrl DGMGRL for Linux: Version 11.2.0.1.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 the configuration DGMGRL> show configuration Configuration - proddb Protection Mode: MaxPerformance Databases: proddb - Primary database standby - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS DGMGRL>
The command SWITCHOVER TO < standby database name >
is used to perform the switchover operation.
DGMGRL> switchover to standby; Performing switchover NOW, please wait... New primary database "standby" is opening... Operation requires shutdown of instance "proddb" on database "proddb" Shutting down instance "proddb"... ORA-01109: database not open Database dismounted. ORACLE instance shut down. Operation requires startup of instance "proddb" on database "proddb" Starting instance "proddb"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "standby" DGMGRL>
Note: You might run into the following error during your switchover when attempting to start the new standby database.
Database dismounted. ORACLE instance shut down. Operation requires startup of instance "proddb" on database "proddb" Starting instance "proddb"... Unable to connect to database ORA-12514: TNS:listener does not currently know of service requested in connect descriptor Failed. Warning: You are no longer connected to ORACLE. Please complete the following steps to finish switchover: start up and mount instance "proddb" of database "proddb" DGMGRL>
The problem is that the Data Guard Broker is attempting to connect to a service called < sid >_DGMGRL
or in this case proddb_DGMGRL
. If you are receiving the error you can exit out of the dgmgrl
and mount the new standby to complete to the switchover. To prevent this problem in the future add a static registration for < sid >_DGMMGRL
to your ORACLE_HOME/network/admin/listener.ora
. Below is an example.
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = proddb_DGMGRL) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = proddb) ) )
A quick show configuration will show that standby is the primary and proddb
is the physical standby.
DGMGRL> show configuration; Configuration - proddb Protection Mode: MaxPerformance Databases: standby - Primary database proddb - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS DGMGRL>
In order to switch back to the original primary database all you need to do is perform the switchover command on the new primary database as detailed below.
[oracle@dreco admin]$ dgmgrl DGMGRL for Linux: Version 11.2.0.1.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 - proddb Protection Mode: MaxPerformance Databases: standby - Primary database proddb - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS DGMGRL> switchover to proddb; Performing switchover NOW, please wait... New primary database "proddb" is opening... Operation requires shutdown of instance "standby" on database "standby" Shutting down instance "standby"... ORA-01109: database not open Database dismounted. ORACLE instance shut down. Operation requires startup of instance "standby" on database "standby" Starting instance "standby"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "proddb" DGMGRL>
Performing a switchover using the Data Guard Command Line interface is a simple and efficient process. However, if you are managing your Data Guard environment with Oracle Enterprise Manager Grid Control you will need to reconfigure the monitoring and metrics for the new primary and standby.
wonderful document……..help full to all……
i am really helpful to you for providing this much…….keep going
thankyou
Hi Eric,
I got the “ORA-12514: TNS:listener does not currently know of service requested in connect descriptor” issue when I tried to swithover to stadnby (from the standby server).
I have the _DGMMGRL present in a IFILE referenced in the “$ORACLE_HOME/network/admin/listener.ora” (both primary and standby listener.ora files).
Does DG not honour IFILE configurations?
Thanks… Satnam
Thanks 🙂