Sometimes listener log file grows very large in size and we have to shrink that in order to reclaim space on the mount. I see some people just wonder how they can compress the listener log file while it is currently in use in production system as they can't just stop and start the listener to compress/rename the file as unavailability of listener will cause user connections to fail and that will be encountered as production outage by end user.
Below I have outlined two steps where we tell listener to stop logging in the listener log file and then rename/compress/purge the listener log file and finally we can tell listener back that it can start logging the info in the listener.log file.
Step : 1 - First of all turn off the logging status of listener using below command at lsnrctl prompt.
LSNRCTL> SET LOG_STATUS OFF Connecting to (ADDRESS=(PROTOCOL=TCP)(HOST=rac1.rajdbsolutions.com)(PORT=1522)) LISTENER parameter "log_status" set to OFF The command completed successfully
After the above step, go to listener log location and rename the listener.log file to something else e.g. Listener_old.log
Again turn back the listener logging ON using below command.
LSNRCTL> SET LOG_STATUS ON Connecting to (ADDRESS=(PROTOCOL=TCP)(HOST=rac1.rajdbsolutions.com)(PORT=1522)) LISTENER parameter "log_status" set to ON The command completed successfully
When you turn ON the listener log using above command, a new listener.log file will be created there and it will be used hereafter for database connectivity.