 |
|
Data Guard switchover
with dgmgrl
Oracle Tips by Burleson Consulting
March 11, 2010
|
Question: I want to use the switchover
command with dgmgrl to switch over to my Data Guard Standby database.
How to I configure my tnsnames with failover for Data Guard switchover
dgmgrl command?
db1 =
(DESCRIPTION =
(ADDRESS_LIST =
(FAILOVER = ON)
(ADDRESS = (PROTOCOL
= TCP)(HOST = host1(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1521)
)
)
Answer: For complete details on doing a
Data Guard switchover, see the book “Oracle
Data Guard” by Bipul Kumar. There are many examples, and Ritesh
Chhajer offers this example of doing a Data Guard switchover using dgmgrl:
1. Ensure SPFILE is used
SQL> sho parameter spfile
2. Verify
dmon process is running and broker parameters viz. DG_BROKER_START is set to
TRUE and DG_BROKER_CONFIG_FILEn are set correctly
SQL> sho parameter broker
$ps -ef|grep dmon|grep -v grep
3. Check if
LOCAL_LISTENER is set(This is needed only if you are non-default port other
than 1521)
DGMGRL> show instance 'TESTPRIR1' 'LocalListenerAddress';
4. Verify
if GLOBAL_DBNAME in listener.ora is set correctly to
<<db_unique_name>>_DGMGRL.<<db_domain>>
Example listener.ora:
SID_LIST_LISTENER_TESTPRIR1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /apps/oracle/product/10g/db)
(PROGRAM = extproc)
)
(SID_DESC
=
(SID_NAME = TESTPRIR1)
(GLOBAL_DBNAME = TESTPRI_DGMGRL)
(ORACLE_HOME = /apps/oracle/product/10g/db)
)
)
Note: In the above case, db_domain was
null.
5. Verify if START_OPTIONS is set to MOUNT in the OCR
$ srvctl config database -d TESTPRI -a
testprir1 TESTPRIR1
/apps/oracle/product/10g/db
testprir2 TESTPRIR2
/apps/oracle/product/10g/db
DB_NAME: null
ORACLE_HOME:
/apps/oracle/product/10g/db
SPFILE:
/n01/oradata/TESTPRI/spfileTESTPRI.ora
DOMAIN: null
DB_ROLE: PRIMARY
START_OPTIONS: MOUNT
6. Broker
configuration is enabled and state of all members as intended is ONLINE
DGMGRL> show configuration
7.
remote_login_passwordfile is set to 'EXCLUSIVE'
SQL> sho parameter remote_login_passwordfile
8. Verify TESTPRI and
TESTDG tnspingable from both primary as well as standby and can connect to
each other.
Let us do the actual
switchover now. Since our primary database is RAC, let us also keep a watch
on how the OCR status is changing.
9. Ensure <<db_unique_name>>_DGMGRL is part of service names otherwise post
switchover, instances may have to be manually started
OCR Config before switchover:
[oracle@testprir1]/apps/oracle/product/10g/db/dbs% srvctl status database -d
TESTPRI
Instance TESTPRIR1 is running on node testprir1
Instance
TESTPRIR2 is running on node testprir2
[oracle@testprir1]/apps/oracle/product/10g/db/dbs% srvctl config database -d
TESTPRI -a
testprir1 TESTPRIR1 /apps/oracle/product/10g/db
testprir2
TESTPRIR2 /apps/oracle/product/10g/db
DB_NAME: null
ORACLE_HOME:
/apps/oracle/product/10g/db
SPFILE:
/n01/oradata/TESTPRI/spfileTESTPRI.ora
DOMAIN: null
DB_ROLE: PRIMARY
START_OPTIONS: MOUNT
Broker config before
switchover:
DGMGRL> show configuration;
Configuration
Name:
DG_TEST
Enabled:
YES
Protection Mode: MaxPerformance
Databases:
TESTPRI - Primary database
TESTDG - Physical
standby database
Current status for "DG_TEST":
SUCCESS
Switchover
Now:
DGMGRL> switchover to 'TESTDG';