Empty/Remove Oracle Listener.log files

The listener.log file grows and its not possible to just move the file whilst the listener is up. The tnslsnr process always hold this log file. This can be confirmed using the command fuser.

$ cd /u01/app/oracle/product/10.2.0/db_1/network/log
$ ls -ltr
-rw-r—– 1 oraprd oinstall 223258461 Mar 17 15:02 listener.log

$ fuser listener.log
listener.log: 27293

$ ps -ef |grep 27293
oraprd 27293 1 0 Dec 02 ? 72:09 /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inher

Fuser shows that its being used by the process 27293, which is the tnslsnr. Now how do we empty/move/rename this log file ?

1.
$ lsnrctl
LSNRCTL>set Log_status off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.169.198)(PORT=1523)(IP=FIRST)))
listener parameter “log_status” set to ON
The command completed successfully
LSNRCTL>exit

$ mv listener.log to listener_old.log (from the command prompt)
$ touch listener.log

$ lsnrctl
LSNRCTL>set Log_Status on
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.169.198)(PORT=1523)(IP=FIRST)))
listener parameter “log_status” set to ON
The command completed successfully
LSNRCTL>exit

2.

The below will empty your listener.log file. ” > ” is part of the command. It just redirect null into the file

$ > listener.log

3.

set LOGGING_LISTENER=OFF in the listener.ora file to stop the listener logging.

Advertisements

5 thoughts on “Empty/Remove Oracle Listener.log files

  1. Pingback: Index « My confrontations with oracle

  2. Good post. I learn something totally new and challenging on
    websites I stumbleupon everyday. It will always be exciting to
    read content from other authors and use a little something from their
    sites.

  3. Linux -11g rac grid user, If we edit the file and delete all records and keep last 500 using => find $ORACLE_BASE/diag -name “*.log” -exec /usr/bin/sed-e :a -e ‘$q;N;500,$D;ba’ -i {} \; Is there any effect to existing/new database connections..? can we do that in oltp env.?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s