How to add a second set of listeners to the specified network card in Oracle restart environment

Time:2021-5-13

**Recently, I came into contact with a case of configuring the second set of listener in restart environment. I hope it will help. If there are any deficiencies, please correct them.

Background:
The customer wants to configure two listeners in Oracle restart environment to listen to the IP addresses corresponding to eth0 and eth1 network cards respectively.

General steps:
Edit listener.ora to configure two listeners (the host part specifies the IP addresses of the two network cards respectively)
Add and start listener resource through srvctl add listener and srvctl start listener commands
View the latest situation of listener resource through crsctl stat res – t command
Lsnrctl status to view the monitoring status of the two listeners (whether to monitor the IP specified on the two network cards respectively)

Implementation example:
-bash-4.2$ cat $ORACLE_HOME/network/admin/listener.ora
listener.ora Network Configuration File: /refresh/app/oracle/product/12.1.0/grid/network/admin/listener.ora
Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =

(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.30.203.165)(PORT = 1521))
  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)

)

LISTENER2 =
(DESCRIPTION_LIST =

(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.10)(PORT = 1741))
  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1741))
)

)

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=SUBNET # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER2=ON # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER2=SUBNET # line added by Agent
-bash-4.2$
-bash-4.2$ srvctl add listener -listener LISTENER2 -s -endpoints TCP:1741
-bash-4.2$
-bash-4.2$ srvctl start listener -listener LISTENER2
-bash-4.2$

-bash-4.2$ crsctl stat res -t

Name Target State Server State details

Local Resources

ora.DATA.dg

           ONLINE  ONLINE       o1asm                  STABLE

ora.LISTENER.lsnr

           ONLINE  ONLINE       olasm                  STABLE

ora.LISTENER2.lsnr★★

Online online olasm stable

ora.asm

           ONLINE  ONLINE       olasm                  Started,STABLE


-bash-4.2$
-bash-4.2$ lsnrctl

LSNRCTL for Linux: Version 12.1.0.2.0 – Production on 25-MAR-2021 09:06:31

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Welcome to LSNRCTL, type “help” for information.

LSNRCTL> status LISTENER
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.30.203.165)(PORT=1521)))

STATUS of the LISTENER

Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 – Production
Start Date 25-MAR-2021 09:05:01
Uptime 0 days 0 hr. 1 min. 35 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /refresh/app/oracle/product/12.1.0/grid/network/admin/listener.ora
Listener Log File /refresh/app/oracle/diag/tnslsnr/olasm/listener/alert/log.xml
Listening Endpoints Summary…
(description = (address = (protocol = TCP) (host = 10.30.203.165) (Port = 1521))) – < monitor the IP of the second NIC
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=5500))(Security=(my_wallet_directory=/refresh/app/oracle/product/12.1.0/ASMdbA/admin/ASMdbA/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM”, status READY, has 1 handler(s) for this service…
Service “ASMdbA.us.oracle.com” has 1 instance(s).
Instance “ASMdbA”, status READY, has 1 handler(s) for this service…
Service “ASMdbAXDB.us.oracle.com” has 1 instance(s).
Instance “ASMdbA”, status READY, has 1 handler(s) for this service…
The command completed successfully
LSNRCTL>
LSNRCTL> status LISTENER2
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.10)(PORT=1741)))

STATUS of the LISTENER

Alias LISTENER2
Version TNSLSNR for Linux: Version 12.1.0.2.0 – Production
Start Date 25-MAR-2021 09:00:42
Uptime 0 days 0 hr. 6 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /refresh/app/oracle/product/12.1.0/grid/network/admin/listener.ora
Listener Log File /refresh/app/oracle/diag/tnslsnr/olasm/listener2/alert/log.xml
Listening Endpoints Summary…
(description = (address = (protocol = TCP) (host = 192.168.10.10) (Port = 1741))) – < monitor the IP of the second NIC
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1741)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1741)))
Services Summary…
Service “ASMdbA.us.oracle.com” has 1 instance(s).
Instance “ASMdbA”, status READY, has 1 handler(s) for this service…
Service “ASMdbAXDB.us.oracle.com” has 1 instance(s).
Instance “ASMdbA”, status READY, has 1 handler(s) for this service…
The command completed successfully
LSNRCTL>

Next, let’s take a brief look at the changes in resources and monitoring status when the new listener is stopped
-bash-4.2$ /refresh/app/oracle/product/12.1.0/grid/bin/srvctl stop listener -listener LISTENER2
-bash-4.2$

-bash-4.2$ /refresh/app/oracle/product/12.1.0/grid/bin/crsctl stat res -t

Name Target State Server State details

Local Resources

ora.DATA.dg

           ONLINE  ONLINE       olasm                  STABLE

ora.LISTENER.lsnr

           ONLINE  ONLINE       olasm                  STABLE

ora.LISTENER2.lsnr

           OFFLINE OFFLINE      olasm                  STABLE


-bash-4.2$ /refresh/app/oracle/product/12.1.0/grid/bin/lsnrctl status LISTENER2

LSNRCTL for Linux: Version 12.1.0.2.0 – Production on 25-MAR-2021 09:15:28

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.10)(PORT=1741)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1741)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
-bash-4.2$