The Default Location of Oracle Listener Log
If you have read Where to Find Oracle Alert Log Location, you may have some clues to find the right listener.log. But there're some differences between them.
For 11g and Later
The default location of listener log for 11g or above can be found at:
[oracle@ora11g ~]$ ll $ORACLE_BASE/diag/tnslsnr/$(hostname -s)/listener/trace/listener.log
-rw-r-----. 1 oracle oinstall 477708 Apr 18 18:25 /u01/app/oracle/diag/tnslsnr/ora11g/listener/trace/listener.log
As you can see in the path, the listener log follows the hostname, whereas the alert log location of database follows the database name (db_name). All paths follow the directory structure of diagnostic repository. That's the difference.
Another way to check the listener log location is to use lsnrctl command:
[oracle@ora11g ~]$ lsnrctl status
...
Listener Log File /u01/app/oracle/diag/tnslsnr/ora11g/listener/alert/log.xml
...
The listed file is a XML-versioned listener.log. Basically, it's not what we are looking for, but they are the same thing essentially.
For 9i and 10g
The default path of the listener log for 9i and 10g is somewhat different:
[oracle@ora9i ~]$ ll $ORACLE_HOME/network/log/listener.log
-rw-r--r-- 1 oracle oinstall 117307 Apr 18 14:26 /u01/app/oracle/product/9.2.0/network/log/listener.log
Eventually, it's in $ORACLE_HOME.
Also, we can use lsnrctl to list the listener log location.
[oracle@ora9i ~]$ lsnrctl status
...
Listener Log File /u01/app/oracle/product/9.2.0/network/log/listener.log
...
It's the same file.
For Cluster Databases
For RAC environments, you have to check the listener logs at grid-level.
[grid@primary01 ~]$ echo $ORACLE_BASE
/u01/app/grid
[grid@primary01 ~]$ ll $ORACLE_BASE/diag/tnslsnr/$(hostname -s)/
total 48
drwxr-xr-x 14 grid oinstall 4096 Aug 11 2015 listener
drwxr-xr-x 14 grid oinstall 4096 Dec 12 2016 listener1
drwxr-xr-x 14 grid oinstall 4096 Dec 12 2016 listener2
drwxr-xr-x 14 grid oinstall 4096 Jan 6 2017 listener2_scan1_net2
drwxr-xr-x 14 grid oinstall 4096 Jan 6 2017 listener2_scan2_net2
drwxr-xr-x 14 grid oinstall 4096 Jan 6 2017 listener2_scan3_net2
drwxr-xr-x 14 grid oinstall 4096 Jan 6 2017 listener2_scan4_net2
drwxr-xr-x 14 grid oinstall 4096 Aug 11 2015 listener_scan1
drwxr-xr-x 14 grid oinstall 4096 Aug 11 2015 listener_scan2
drwxr-xr-x 14 grid oinstall 4096 Aug 11 2015 listener_scan3
drwxr-xr-x 14 grid oinstall 4096 Dec 20 2016 listener_scan4
drwxr-xr-x 14 grid oinstall 4096 Aug 11 2015 mgmtlsnr
The local listener log for the instance is usually at:
[grid@primary01 ~]$ ll $ORACLE_BASE/diag/tnslsnr/$(hostname -s)/listener/trace/listener.log
-rw-r----- 1 grid oinstall 882660 Jul 6 11:07 /u01/app/grid/diag/tnslsnr/primary01/listener/trace/listener.log
Or the equivalent log in XML format:
[grid@primary01 ~]$ lsnrctl status
...
Listener Log File /u01/app/grid/diag/tnslsnr/primary01/listener/alert/log.xml
Find the Location of Oracle Listener Log by OS Commands
In case that the listener log is nowhere to be found, you can still use OS commands to find it.
Using Find Command
Almost all UNIX and Linux support find command, so using it to find some files is a very common way to do it.
[oracle@ora11g ~]$ find $ORACLE_BASE -type f -name listener.log
/u01/app/oracle/diag/tnslsnr/ora11g/listener/trace/listener.log
/u01/app/oracle/product/11.2.0/dbhome_1/listener.log
The first file is the right file that we're looking for. The second file is not.
Using Locate Command
Sometimes, using locate command will be faster than find.
[oracle@ora11g ~]$ locate listener.log
/u01/app/oracle/diag/tnslsnr/ora11g/listener/trace/listener.log
/u01/app/oracle/product/11.2.0/dbhome_1/listener.log
The result of locate is the same as the result of find, but it's faster.
Great article!
On the Oracle Database Appliance HA, the listener log will be in:
/u01/app/grid/diag/tnslsnr//listener/alert/log.xml
Updated log location:
/u01/app/grid/diag/tnslsnr/HOSTNAME/listener/alert
Thanks for your input!