These oracle stuffs might come in handy...

Monday, March 17, 2008

How to rename the listener.log file


The listener.log file might keep growing due to the messages logged. We cannot rename the log file on the fly as it will be always accessed by the tnslsnr process.

$ 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.

So,
$ 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 onConnecting 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

Or

If you do not want the messages to be logged set LOGGING_LISTENER=OFF in the listener.ora file