listener

Listener and Virtual IP

When you configure a standby database, you want the application to transparently connect to the primary database, wherever it is. That’s the role of Transparent Application Failover, but this requires configuration on the client side. If you can’t configure TAF, you can use a virtual IP address. But then the question is how to configure the listener.ora to handle connections to this VIP.

Don’t worry, if you configured everything as recommended, with the hostname declared in /etc/hosts, and listener.ora referencing this host name, then you can simply ignore the VIP for your configuration. The reason is that when the host specified in the listener.ora resolves to the same IP address as the hostname of the server, then Oracle listener binds the port on all interfaces, and this includes the VIP.

Where are the logs for the SCAN listeners?

Quick post and note to self. Where are the SCAN listener log files? A little bit of troubleshooting was required, but I guess I could have read the manuals too. In the end it turned out to be quite simple!

First of all, I needed to find out where on my four node cluster I had a SCAN listener. This is done quite easily by asking Clusterware:

[grid@rac11gr2node2 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node rac11gr2node2
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node rac11gr2node4
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node rac11gr2node3

I was initially on the first node, so had to ssh to the second. From there on I thought that the proc file system might have the answer. I needed to get the PID of the SCAN listener first:

[grid@rac11gr2node2 ~]$ ps -ef | grep -i scan
grid      4738     1  0 Jun03 ?        00:00:13 /u01/app/grid/product/11.2.0/crs/bin/tnslsnr LISTENER_SCAN1 -inherit
grid     24694 24147  0 20:55 pts/0    00:00:00 grep -i scan

Now /proc/4738/fd lists all the open file descriptors used by the SCAN listener. Surely the log.xml file would be there somewhere:

[grid@rac11gr2node2 ~]$ ll /proc/4738/fd
total 0
lrwx------ 1 grid oinstall 64 Jun 16 20:46 0 -> /dev/null
lrwx------ 1 grid oinstall 64 Jun 16 20:46 1 -> /dev/null
lrwx------ 1 grid oinstall 64 Jun 16 20:46 10 -> socket:[20906]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 11 -> socket:[20908]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 12 -> socket:[20927]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 13 -> socket:[20957]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 14 -> socket:[20958]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 15 -> socket:[22991]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 16 -> socket:[10712179]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 17 -> socket:[10173760]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 18 -> socket:[10176036]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 19 -> socket:[9106216]
lrwx------ 1 grid oinstall 64 Jun 16 20:46 2 -> /dev/null
lr-x------ 1 grid oinstall 64 Jun 16 20:46 3 -> /u01/app/grid/product/11.2.0/crs/rdbms/mesg/diaus.msb
lr-x------ 1 grid oinstall 64 Jun 16 20:46 4 -> /proc/4738/fd
lr-x------ 1 grid oinstall 64 Jun 16 20:46 5 -> /u01/app/grid/product/11.2.0/crs/network/mesg/nlus.msb
lr-x------ 1 grid oinstall 64 Jun 16 20:46 6 -> pipe:[20893]
lr-x------ 1 grid oinstall 64 Jun 16 20:46 7 -> /u01/app/grid/product/11.2.0/crs/network/mesg/tnsus.msb
lrwx------ 1 grid oinstall 64 Jun 16 20:46 8 -> socket:[20904]
l-wx------ 1 grid oinstall 64 Jun 16 20:46 9 -> pipe:[20894]

Well maybe not. Next option is to query the listener itself via lsnrctl. Nothing easier that that:

LSNRCTL> set current_listener LISTENER_SCAN1
Current Listener is LISTENER_SCAN1
LSNRCTL> show log_file
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
LISTENER_SCAN1 parameter "log_file" set to /u01/app/grid/product/11.2.0/crs/log/diag/tnslsnr/rac11gr2node2/listener_scan1/alert/log.xml
The command completed successfully
LSNRCTL>

Aha, it uses the ADR as well. So back there, change the base and query the file:

[grid@rac11gr2node2 ~]$ adrci

ADRCI: Release 11.2.0.1.0 - Production on Wed Jun 16 20:58:17 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u01/app/oracle"
adrci> set base /u01/app/grid/product/11.2.0/crs/log
adrci> show home
ADR Homes:
diag/tnslsnr/rac11gr2node2/listener_scan1
diag/tnslsnr/rac11gr2node2/listener_scan3
diag/tnslsnr/rac11gr2node2/listener_scan2
adrci> set home diag/tnslsnr/rac11gr2node2/listener_scan1
adrci> show alert -tail
2010-06-16 20:58:25.021000 +01:00
16-JUN-2010 20:58:25 * service_update * polstdby_1 * 0
2010-06-16 20:58:27.441000 +01:00
16-JUN-2010 20:58:27 * service_update * poldb_2 * 0
2010-06-16 20:58:30.444000 +01:00
16-JUN-2010 20:58:30 * service_update * poldb_2 * 0
16-JUN-2010 20:58:30 * service_update * poldb_1 * 0
2010-06-16 20:58:33.442000 +01:00
16-JUN-2010 20:58:33 * service_update * poldb_2 * 0
2010-06-16 20:58:35.784000 +01:00
16-JUN-2010 20:58:35 * service_update * prod1 * 0
16-JUN-2010 20:58:36 * service_update * poldb_2 * 0
16-JUN-2010 20:58:36 * service_update * poldb_1 * 0
2010-06-16 20:58:39.546000 +01:00
16-JUN-2010 20:58:39 * service_update * poldb_2 * 0
16-JUN-2010 20:58:39 * service_update * poldb_1 * 0
2010-06-16 20:58:42.574000 +01:00
16-JUN-2010 20:58:42 * service_update * poldb_2 * 0
2010-06-16 20:58:45.574000 +01:00
16-JUN-2010 20:58:45 * service_update * poldb_2 * 0
2010-06-16 20:58:48.576000 +01:00
16-JUN-2010 20:58:48 * service_update * poldb_2 * 0
16-JUN-2010 20:58:48 * service_update * poldb_1 * 0
2010-06-16 20:58:51.575000 +01:00
16-JUN-2010 20:58:51 * service_update * poldb_2 * 0
16-JUN-2010 20:58:51 * service_update * poldb_1 * 0
2010-06-16 20:58:54.578000 +01:00
16-JUN-2010 20:58:54 * service_update * poldb_2 * 0

Job done.