Note: Static “_DGMGRL” entries are no longer needed as of Oracle Database 12.1.0.2 in Oracle Data Guard Broker configurations that are managed by Oracle Restart, RAC On Node or RAC as the Broker will use the clusterware to restart an instance.
When you start the Data Guard Broker (DMON)-Process on your Primary and Standby Database, it will start and register Services on the Local Listener: _DGB.: This Service is used by the DMON-Processes to communicate between each other
[grid@11g-node1 ~]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:07:17
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 06-DEC-2022 09:01:23 Uptime 63 days 21 hr. 5 min. 54 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.84)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.82)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "rac11g" has 1 instance(s). Instance "rac11g1", status READY, has 1 handler(s) for this service... The command completed successfully
1.2 listener.ora 监听文件新增静态注册
1
[grid@11g-node1 ~]$ vi /u01/app/11.2.0.4/grid/network/admin/listener.ora
[grid@11g-node1 ~]$cat /u01/app/11.2.0.4/grid/network/admin/listener.ora LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:12:53
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) The command completed successfully [grid@11g-node2 ~]$ lsnrctl status wait a limite [grid@11g-node1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:14:14
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 06-DEC-2022 09:01:23 Uptime 63 days 21 hr. 12 min. 50 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.82)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.84)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "rac11g" has 1 instance(s). Instance "rac11g1", status READY, has 1 handler(s) for this service... Service "rac11g_DGMGRL" has 1 instance(s). Instance "rac11g1", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
1.5 _DGMGRL 服务确认
可以看到监听新增了 rac11g_DGMGRL 的 Service ,其status 为静态注册 (UNKNOWN),对应的 Instance 是 rac11g1
[grid@11g-node2 ~]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:12:11
Copyright (c) 1991, 2013, Oracle. All rights reserved. LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 04-DEC-2022 19:28:20 Uptime 65 days 10 hr. 43 min. 51 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.85)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.83)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM2", status READY, has 1 handler(s) for this service... Service "rac11g" has 1 instance(s). Instance "rac11g2", status READY, has 1 handler(s) for this service... The command completed successfully [grid@11g-node2 ~]$ vi /u01/app/11.2.0.4/grid/network/admin/listener.ora 新增如下内容 ------ SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = rac11g_DGMGRL) (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1) (SID_NAME = rac11g2) ) ) ------ reload 监听 [grid@11g-node2 ~]$ lsnrctl reload
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:12:53
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) The command completed successfully [grid@11g-node2 ~]$ lsnrctl status Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.83)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.85)(PORT=1521))) Services Summary... Service "rac11g" has 1 instance(s). Instance "rac11g2", status READY, has 1 handler(s) for this service... Service "rac11g_DGMGRL" has 1 instance(s). Instance "rac11g2", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
oracle@dgbrok:/home/oracle $lsnrctl status LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:18:45
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.8.8..201)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 13-JAN-2023 21:33:47 Uptime 25 days 8 hr. 44 min. 58 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/dgbrok/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8..201)(PORT=1521))) Services Summary... Service "RAC11G" has 1 instance(s). Instance "RAC11GDG", status READY, has 1 handler(s) for this service... Service "RAC11GDG" has 2 instance(s). Instance "RAC11GDG", status UNKNOWN, has 1 handler(s) for this service... Instance "RAC11GDG", status READY, has 1 handler(s) for this service... The command completed successfully oracle@dgbrok:/home/oracle $vi /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora ---- old LISTENER= (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.8.8..201)(PORT = 1521)) ) )
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:26:25
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgbrok)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 08-FEB-2023 06:25:47 Uptime 0 days 0 hr. 0 min. 37 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/dgbrok/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgbrok)(PORT=1521))) Services Summary... Service "RAC11G" has 1 instance(s). Instance "RAC11GDG", status READY, has 1 handler(s) for this service... Service "RAC11GDG" has 2 instance(s). Instance "RAC11GDG", status UNKNOWN, has 1 handler(s) for this service... Instance "RAC11GDG", status READY, has 1 handler(s) for this service... Service "RAC11GDG_DGMGRL" has 1 instance(s). Instance "RAC11GDG", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
可以看到监听新增了 RAC11GDG_DGMGRL 的 Service ,其 status 为静态注册 (UNKNOWN),对应的 Instance 是 RAC11GDG
SQL> NAME TYPE VALUE ------------------------------------ ------- ------------------------------ dg_broker_config_file1 string +data/RAC11G/dgbroker/dgb_config1.ora dg_broker_config_file2 string +data/RAC11G/dgbroker/dgb_config2.ora dg_broker_start booleanTRUE
oracle@11g-node1:/home/oracle $oerr ORA 16532 16532, 00000, "Data Guard broker configuration does not exist" // *Cause: A broker operation was requested that required a broker // configuration to already be created. // *Action: Create a Data Guard broker configuration prior to performing // other broker operations. If only one instance of a RAC // database is reporting this error, ensure that the // DG_BROKER_CONFIG_FILE[1|2] initialization parameters are // set to file locations that are shared by all instances of // the RAC database.
3.3 配置 DG Broker
登录 dgmgrl
1 2 3 4 5 6 7
oracle@11g-node1:/home/oracle $ dgmgrl sys/password@rac11g_RAC11GDG DGMGRL for Linux: Version 11.2.0.4.0-64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information. Connected.
配置 DG Broker
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
DGMGRL>CREATE CONFIGURATION dgbrok ASPRIMARY DATABASE IS rac11g CONNECT IDENTIFIER IS rac11g_RAC11GDG; Configuration "dgbrok" created withprimary database "rac11g" DGMGRL>ADD DATABASE RAC11GDG ASCONNECT IDENTIFIER IS RAC11GDG_rac11g MAINTAINED AS PHYSICAL; Database "rac11gdg" added DGMGRL>show configuration;
show configuration; show database rac11g; show database rac11gdg; show database verbose rac11g; show database verbose rac11gdg; DGMGRL> show database verbose rac11g;
DGMGRL> switchover to rac11gdg; Performing switchover NOW, please wait... Operation requires a connection to instance "RAC11GDG" on database "rac11gdg" Connecting to instance "RAC11GDG"... Connected. Newprimary database "rac11gdg" is opening... Operation requires startup of instance "rac11g1" on database "rac11g" Starting instance "rac11g1"... ORACLE instance started. Database mounted. Database opened. Switchover succeeded, newprimaryis "rac11gdg"
DG Broker 回切
1 2 3 4 5 6 7 8 9 10 11 12
DGMGRL> switchover to rac11g; Performing switchover NOW, please wait... Operation requires a connection to instance "rac11g1" on database "rac11g" Connecting to instance "rac11g1"... Connected. Newprimary database "rac11g" is opening... Operation requires startup of instance "RAC11GDG" on database "rac11gdg" Starting instance "RAC11GDG"... ORACLE instance started. Database mounted. Database opened. Switchover succeeded, newprimaryis "rac11g"
在本次回切的过程中遇到了 ORA-12545: Connect failed because target host or object does not exist 详见下一篇水文。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
DGMGRL> switchover to rac11g; Performing switchover NOW, please wait... Operation requires a connection to instance "rac11g1" on database "rac11g" Connecting to instance "rac11g1"... Connected. Newprimary database "rac11g" is opening... Operation requires startup of instance "RAC11GDG" on database "rac11gdg" Starting instance "RAC11GDG"... Unable toconnectto database ORA-12545: Connect failed because target host or object does not exist
Failed. Warning: You areno longer connected to ORACLE.
Please complete the following steps to finish switchover: start up instance "RAC11GDG" of database "rac11gdg"