Monday, July 8, 2013

Empty Oracle Listener.log files

The listener.log file grows and it’s not possible to just move the file whilst the listener is up.  The tnslsnr process always holds this log file.


Procedure 1:
LSNRCTL>  set Log_status off
$ mv listener.log  listener_old.log
$  touch listener.log
LSNRCTL>  set Log_status on

Procedure 2: Create batch script like below and schedule to run once a week
$ more truncate_listener.sh
cd /u00/app/oracle/product/10.2.0/network/log/
cp listener.log /u00/app/oracle/product/10.2.0/network/log/backup/listener_`date '+%Y%m%d'`.log
echo > listener.log

Procedure 3: Stop Listener logs
set LOGGING_LISTENER=OFF in the listener.ora file to stop the listener logging.