By Brian Fitzgerald
Introduction
In Oracle Restart, _DGMGRL services are no longer required in listener.ora. Switchover output has changed slightly and _DGMGRL connections no longer appear in the listener log.
Background
While testing switchover in Data Guard in 19c, I noticed that after configuring Restart, connections to _DGMGRL longer appeared in the listener log. I deleted the _DGMGRL services, reloaded the listeners, and retested the switchover without issue.
Static listeners (initial)
Initially, in the grid account, in $ORACLE_HOME/network/admin/listener.ora, these SID_LIST_LISTENER were in place. At the primary:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = NY_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = ORCL)
)
)
At the far sync:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = FS_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = ORCL)
)
)
At the standby:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = SF_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = ORCL)
)
)
I reloaded the listeners at each host:
[grid@ip-172-31-86-22 ~]$ lsnrctl reload LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-SEP-2019 12:28:09 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip-172-31-86-22.ec2.internal)(PORT=1521))) The command completed successfully
Switchover test before setting up Restart
The following switchover test without Restart was done:
DGMGRL> switchover to SF Performing switchover NOW, please wait... Operation requires a connection to database "SF" Connecting ... Connected to "SF" Connected as SYSDBA. New primary database "SF" is opening... Operation requires start up of instance "ORCL" on database "NY" Starting instance "ORCL"... Connected to an idle instance. ORACLE instance started. Connected to "NY" Database mounted. Connected to "NY" Switchover succeeded, new primary is "sf"
Notice the message ‘Operation requires start up of instance “ORCL” on database “NY”‘. In the NY listener log, several connections to service NY_DGMGRL appear. For example:
02-SEP-2019 22:46:10 * (CONNECT_DATA=(SERVICE_NAME=NY_DGMGRL)(INSTANCE_NAME=ORCL)(SERVER=DEDICATED)(CID=(PROGRAM=dgmgrl)(HOST=ip-172-31-86-22.ec2.internal)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=172.31.86.22)(PORT=51298)) * establish * NY_DGMGRL * 0
Run “show configuration”:
DGMGRL> show configuration
Configuration - ORCL_CONFIG
Protection Mode: MaxPerformance
Members:
SF - Primary database
FS - Far sync instance
NY - Physical standby database
Fast-Start Failover: Disabled
Configuration Status:
SUCCESS (status updated 51 seconds ago)
Switch back to the original primary.
DGMGRL> switchover to NY Performing switchover NOW, please wait... New primary database "NY" is opening... Operation requires start up of instance "ORCL" on database "SF" Starting instance "ORCL"... Connected to an idle instance. ORACLE instance started. Connected to "SF" Database mounted. Connected to "SF" Switchover succeeded, new primary is "ny"
Notice the message ‘Operation requires start up of instance “ORCL” on database “SF”‘ . In the SF listener log, several connections to service SF_DGMGRL appear. For example:
02-SEP-2019 22:43:08 * (CONNECT_DATA=(SERVICE_NAME=SF_DGMGRL)(INSTANCE_NAME=ORCL)(SERVER=DEDICATED)(CID=(PROGRAM=dgmgrl)(HOST=ip-172-31-86-22.ec2.internal)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=172.31.86.22)(PORT=50340)) * establish * SF_DGMGRL * 0
Notice already at the far sync, no connections to the FS_DGMGRL service appeared. Service FS_DGMGRL plays no role at the far sync.
Configure Restart
Register your Restart instances.
At the primary:
[oracle@ip-172-31-86-22 ~]$ srvctl add database -database NY -role PRIMARY -stopoption IMMEDIATE -instance ORCL -oraclehome /u01/app/oracle/product/19.3.0/dbhome_1 -spfile +DATA01/ORCL/PARAMETERFILE/spfile.266.1017440879 -diskgroup DATA01,RECO01
At the far sync:
[oracle@ip-172-31-28-23 ~]$ srvctl add database -database FS -role physical_standby -startoption MOUNT -stopoption ABORT -instance ORCL -oraclehome /u01/app/oracle/product/19.3.0/dbhome_1 -spfile /u01/app/oracle/product/19.3.0/dbhome_1/dbs/spfileORCL.ora -diskgroup DATA01,RECO01
To activate the change, I found it necessary to issue srvctl start. That does not seem right. “srvctl enable database” should do it.
Also, in Restart, “srvctl enable instance” is not available. “srvctl enable instance” only works in RAC.
Unless you activate the instance, it will not start automatically upon host reboot.
[oracle@ip-172-31-28-23 ~]$ srvctl start database -database FS
At the standby:
[oracle@ip-172-32-10-34 ~]$ srvctl add database -database SF -role physical_standby -startoption MOUNT -stopoption ABORT -instance ORCL -oraclehome /u01/app/oracle/product/19.3.0/dbhome_1 -spfile /u01/app/oracle/product/19.3.0/dbhome_1/dbs/spfileORCL.ora -diskgroup DATA01,RECO01 [oracle@ip-172-32-10-34 ~]$ srvctl start database -database SF
Reboot all hosts and check that the database instances start automatically, in the proper startup mode and Data Guard role.
Switchover test
Test switchover to SF. The output changes slightly, and becomes:
DGMGRL> switchover to SF Performing switchover NOW, please wait... Operation requires a connection to database "SF" Connecting ... Connected to "SF" Connected as SYSDBA. New primary database "SF" is opening... Oracle Clusterware is restarting database "NY" ... Connected to an idle instance. Connected to an idle instance. Connected to an idle instance. Connected to an idle instance. Connected to "NY" Connected to "NY" Switchover succeeded, new primary is "sf"
After configuring Restart, the Data Guard switchover output has changed slightly. Message ‘Operation requires start up of instance “ORCL” on database “NY”‘ has been replaced with ‘Oracle Clusterware is restarting database “NY” …’. A review of the NY listener log shows no connection to service NY_DGMGRL.
Test switchover to NY. The output is now:
DGMGRL> switchover to NY Performing switchover NOW, please wait... New primary database "NY" is opening... Oracle Clusterware is restarting database "SF" ... Connected to an idle instance. Connected to an idle instance. Connected to "SF" Connected to "SF" Switchover succeeded, new primary is "ny"
A review of the SF listener log shows no connection to service SF_DGMGRL.
Static listeners (final)
In Restart, therefore, the “_DGMGRL” listener.ora entry is not needed. SID_LIST_LISTENER can be simplified on the primary, far sync, and standby as:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /u01/app/oracle/product/19.3.0/dbhome_1)
(SID_NAME = ORCL)
)
)
After configuring Oracle Restart, switchovers were retested with the revised listener.ora without issue.
Error in non-Restart and no DGMGRL
Suppose we disable restart at NY.
[oracle@ip-172-31-86-22 ~]$ srvctl stop database -database NY
[oracle@ip-172-31-86-22 ~]$ srvctl remove database -database NY -y
[oracle@ip-172-31-86-22 dbs]$ cat > initORCL.ora
spfile='+DATA01/NY/PARAMETERFILE/spfile.263.1018152951'
[oracle@ip-172-31-86-22 dbs]$ sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 12 11:07:20 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1140849904 bytes
Fixed Size 8895728 bytes
Variable Size 318767104 bytes
Database Buffers 805306368 bytes
Redo Buffers 7880704 bytes
Database mounted.
Database opened.
DGMGRL> show configuration
Configuration - ORCL_CONFIG
Protection Mode: MaxAvailability
Members:
NY - Primary database
SF - Physical standby database
Fast-Start Failover: Disabled
Configuration Status:
SUCCESS (status updated 11 seconds ago)
(Note: In this example, there is no far sync.) Now try a switchover:
DGMGRL> switchover to SF
Performing switchover NOW, please wait...
Operation requires a connection to database "SF"
Connecting ...
Connected to "SF"
Connected as SYSDBA.
New primary database "SF" is opening...
Operation requires start up of instance "ORCL" on database "NY"
Starting instance "ORCL"...
Unable to connect to database using (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip-172-31-86-22.ec2.internal)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=NY_DGMGRL)(INSTANCE_NAME=ORCL)(SERVER=DEDICATED)))
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Failed.
Please complete the following steps to finish switchover:
start up and mount instance "ORCL" of database "NY"
The new primary, SF, opens just fine. The old primary, NY, got shut down, but now there is no way for the broker to restart it. The listener is not listening on behalf of the oracle database.
[grid@ip-172-31-86-22 ~]$ lsnrctl status LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 12-SEP-2019 11:26:00 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip-172-31-86-22.ec2.internal)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 12-SEP-2019 10:15:24 Uptime 0 days 1 hr. 10 min. 36 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/19.3.0/grid/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/ip-172-31-86-22/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ip-172-31-86-22.ec2.internal)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM", status READY, has 1 handler(s) for this service... Service "+ASM_DATA01" has 1 instance(s). Instance "+ASM", status READY, has 1 handler(s) for this service... Service "+ASM_RECO01" has 1 instance(s). Instance "+ASM", status READY, has 1 handler(s) for this service... The command completed successfully
This error referring to misssing service NY_DGMGRL appears in the listener log:
12-SEP-2019 11:22:09 * (CONNECT_DATA=(SERVICE_NAME=NY_DGMGRL)(INSTANCE_NAME=ORCL)(SERVER=DEDICATED)(CID=(PROGRAM=dgmgrl)(HOST=ip-172-31-86-22.ec2.internal)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=172.31.86.22)(PORT=53930)) * establish * NY_DGMGRL * 12514 TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
The conclusion is that without Restart we need the static listener and the DGMGRL in SID_LIST_LISTENER.
Validate static listeners
Validating the static listeners is a critical Data Guard setup step. After duplicating the database and setting up Restart, check each static listener.:
- Connect over the network with sqlplus
- Shutdown (shutdown abort for standbys and far syncs)
- Startup (startup mount for standbys and far syncs)
Example:
[oracle@ip-172-31-28-23 ops]$ sqlplus sys/zystm.22@FS as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Fri Sep 13 11:36:37 2019 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> shutdown abort ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 1140849904 bytes Fixed Size 8895728 bytes Variable Size 301989888 bytes Database Buffers 822083584 bytes Redo Buffers 7880704 bytes Database mounted.
This is an example of a failed static listener check.
[oracle@ip-172-31-28-23 ops]$ sqlplus sys/zystm.22@FS as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Fri Sep 13 11:36:37 2019 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> shutdown abort ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 1140849904 bytes Fixed Size 8895728 bytes Variable Size 301989888 bytes Database Buffers 822083584 bytes Redo Buffers 7880704 bytes Database mounted. SQL> shutdown abort ORACLE instance shut down. ERROR: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor SQL> startup mount SP2-0640: Not connected
Resolve all failures before proceeding.
Conclusion
In Oracle Database 12.1, the Data Guard Broker Manager tool (dgmgrl) was modified so that in Restart or RAC, “_DGMGRL” is no longer required. This fact is mentioned in Oracle Data Guard Broker and Static Service Registration (Doc ID 1387859.1).
On the other hand, if you are not using Restart, then you do need DGMGRL in your SID_LIST_LISTENER.
Restart is only available with Grid Infrastructure. The main benefit of Grid Infrastructure is ASM. If you built Oracle Database on operating system files, then you have less of a need for Grid Infrastructure. If you did not install Grid Infrastructure, then Restart is not available. Without Retstart, a Data Guard setup will need a DGMGRL service in SID_LIST_LISTENER.
During Data Guard setup, validate all static listeners.