DGMGRL> SWITCHOVER TO sbdb1;
Performing switchover NOW, please wait...
New primary database "sbdb1" is opening...
Operation requires shutdown of instance "prod1" on database "prod1"
Shutting down instance "prod1"...
ORACLE instance shut down.
Operation requires startup of instance "prod1" on database "prod1"
Starting instance "prod1"...
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 instance "prod1" of database "prod1"
切换回来,不会报错:
DGMGRL> SWITCHOVER TO prod1;
Performing switchover NOW, please wait...
New primary database "prod1" is opening...
Operation requires shutdown of instance "sbdb1" on database "sbdb1"
Shutting down instance "sbdb1"...
ORACLE instance shut down.
Operation requires startup of instance "sbdb1" on database "sbdb1"
Starting instance "sbdb1"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "prod1"
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbj2p1.example.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 17-NOV-2016 14:44:06
Uptime 0 days 5 hr. 39 min. 6 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/edbj2p1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edbj2p1.example.com)(PORT=1521)))
Services Summary...
Service "prod1.us.oracle.com" has 2 instance(s).
Instance "prod1", status UNKNOWN, has 1 handler(s) for this service...
Instance "prod1", status READY, has 1 handler(s) for this service...
Service "prod1XDB.us.oracle.com" has 1 instance(s).
Instance "prod1", status READY, has 1 handler(s) for this service...
Service "prod1_DGB.us.oracle.com" has 1 instance(s).
Instance "prod1", status READY, has 1 handler(s) for this service...
Service "prod2" has 1 instance(s).
Instance "prod2", status READY, has 1 handler(s) for this service...
Service "prod2XDB" has 1 instance(s).
Instance "prod2", status READY, has 1 handler(s) for this service...
Service "prod2_DGB" has 1 instance(s).
Instance "prod2", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> reload
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbj2p1.example.com)(PORT=1521)))
The command completed successfully
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbj2p1.example.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 17-NOV-2016 14:44:06
Uptime 0 days 5 hr. 39 min. 16 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/edbj2p1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edbj2p1.example.com)(PORT=1521)))
Services Summary...
Service "prod1.us.oracle.com" has 1 instance(s).
Instance "prod1", status READY, has 1 handler(s) for this service...
Service "prod1XDB.us.oracle.com" has 1 instance(s).
Instance "prod1", status READY, has 1 handler(s) for this service...
Service "prod1_DGB.us.oracle.com" has 1 instance(s).
Instance "prod1", status READY, has 1 handler(s) for this service...
Service "prod1_DGMGRL.us.oracle.com" has 1 instance(s).
Instance "prod1", status UNKNOWN, has 1 handler(s) for this service...
Service "prod2" has 1 instance(s).
Instance "prod2", status READY, has 1 handler(s) for this service...
Service "prod2XDB" has 1 instance(s).
Instance "prod2", status READY, has 1 handler(s) for this service...
Service "prod2_DGB" has 1 instance(s).
Instance "prod2", status READY, has 1 handler(s) for this service...
The command completed successfully
再去切换测试:
DGMGRL> SWITCHOVER TO sbdb1;
Performing switchover NOW, please wait...
New primary database "sbdb1" is opening...
Operation requires shutdown of instance "prod1" on database "prod1"
Shutting down instance "prod1"...
ORACLE instance shut down.
Operation requires startup of instance "prod1" on database "prod1"
Starting instance "prod1"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "sbdb1"
DGMGRL>