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.