In this post, we would like to check not only the statuses of listeners, but also services registered with those listeners.
srvctl status listener
Cluster command srvctl status listener is to check the statuses of local listener for each node. Here we introduce all usages of this command in this post.
Check All Local Listener on All Nodes
If there's only one local listener on each node, the standard output you might see is as below.
[grid@primary01 ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): primary01,primary02
To check all local listeners including the newly created one which is added by srvctl add listener, we can also use the command.
[grid@primary01 ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): primary01,primary02
Listener LISTENER2 is enabled
Listener LISTENER2 is running on node(s): primary01,primary02
Where LISTENER2 is the backup local listener which is listening to port 1522.
Check Local Listener on Specific Node
To check the listener status for specific node, we use option -n.
[grid@primary01 ~]$ srvctl status listener -n primary02
Listener LISTENER is enabled on node(s): primary02
Listener LISTENER is running on node(s): primary02
Listener LISTENER2 is enabled on node(s): primary02
Listener LISTENER2 is running on node(s): primary02
Check Specific Local Listener on All Nodes
To check the specific listener status, we use option -l.
[grid@primary01 ~]$ srvctl status listener -l LISTENER2
Listener LISTENER2 is enabled
Listener LISTENER2 is running on node(s): primary01,primary02
As you can see, LISTENER2 is enabled and running on all nodes.
Please note that, command srvctl status listener shows only the status of each local listener. Even though you add -verbose, no more information can be seen.
lsnrctl status for Local Listeners
To know what services are registered with the listener, we should use lsnrctl status to display them.
Listener in Current Server
[grid@primary01 ~]$ lsnrctl status
...
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.11)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.111)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=primary01)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/19.0.0/db_1/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "ORCLCDB" has 1 instance(s).
Instance "ORCLCDB1", status READY, has 1 handler(s) for this service...
Service "ORCLCDBXDB" has 1 instance(s).
Instance "ORCLCDB1", status READY, has 1 handler(s) for this service...
Service "c7d97e0fd8cf8215e0530c01a8c03590" has 1 instance(s).
Instance "ORCLCDB1", status READY, has 1 handler(s) for this service...
Service "orclpdb" has 1 instance(s).
Instance "ORCLCDB1", status READY, has 1 handler(s) for this service...
The command completed successfully
Listener in Remote Server
Here we execute the command on the remote server via SSH tunnel.
[grid@primary01 ~]$ ssh primary02 "source ~/.bash_profile; lsnrctl status"
...
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.12)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.112)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=primary02)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/19.0.0/db_1/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "ORCLCDB" has 1 instance(s).
Instance "ORCLCDB2", status READY, has 1 handler(s) for this service...
Service "ORCLCDBXDB" has 1 instance(s).
Instance "ORCLCDB2", status READY, has 1 handler(s) for this service...
Service "c7d97e0fd8cf8215e0530c01a8c03590" has 1 instance(s).
Instance "ORCLCDB2", status READY, has 1 handler(s) for this service...
Service "orclpdb" has 1 instance(s).
Instance "ORCLCDB2", status READY, has 1 handler(s) for this service...
The command completed successfully
lsnrctl status for SCAN Listeners
Yes, that's true. We can also use lsnrctl status to check what services are registered with SCAN listeners.
First of all, we need to know how SCAN listeners are located.
[grid@primary01 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node primary02
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node primary01
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node primary01
SCAN Listener LISTENER_SCAN4 is enabled
SCAN listener LISTENER_SCAN4 is running on node primary01
As we can see, except for the first one, the rest SCAN are located at current server. Therefore, to check the 4 SCAN listeners, we issue the following commands.
[grid@primary01 ~]$ ssh primary02 "source ~/.bash_profile; lsnrctl status LISTENER_SCAN1"
[grid@primary01 ~]$ lsnrctl status LISTENER_SCAN2
[grid@primary01 ~]$ lsnrctl status LISTENER_SCAN3
[grid@primary01 ~]$ lsnrctl status LISTENER_SCAN4
You may now inspect those registered services closely.