listener.log too big

My big Oracle listener log

My listener.log file is growing and now it is very big; I have difficulties to open it.
What can I do when the listener.log is growing? Indeed, if you delete the LISTENER.LOG, the file will be recreated only after stopping and starting the listener …

I want to archive it without boucing the listener (online operation).

 

For Oracle < 11g:

# START LSNRCTL UTILITY
$lsnrctl # SET MY CURRENT LISTENER IF IT'S DIFFERENT FROM THE DEFAULT LSNRCTL>
set current_listener LISTENER_APP

# CHANGE LISTENER LOG LOCATION TO ANOTHER FILE
LSNRCTL> set log_file my_temp_listener.log
--> This command creates a new log file.
LSNRCTL> exit

# RENAME MY BIG LISTENER
# Unix:
$ mv listener.log listener.log.mydate
# Windows: copy ... or copy/paste :)
IN LSNRCTL UTILITY
### RENAME my_temp_listener.log BACK TO listener.log
LSNRCTL> set log_file listener
LSNRCTL> exit

 

For Oracle >= 11g

Oracle version 11g introduced the ADR or Automatic Diagnostic Repository feature. listener.log is written to xml file.

When I try to change the log file location using LSNRCTL utility, it will fail with:
TNS-01251: Cannot set trace/log directory under ADR.

The same error will get thrown when trying to change the trc_directory.

If the parameter DIAG_ADR_ENABLED_mylistener is set to ON in the listener.ora file, the parameter log_directory is ignored. The trace and log files are created in the location defined by ADR_BASE_mylistener.
– You can use the listener.ora ADR_BASE_mylistener parameter to specify the base directory into which tracing and logging incidents are stored when ADR is enabled.
– You can also disable ADR by setting in listener.ora :

DIAG_ADR_ENABLED_listener_name=OFF
LOG_DIRECTORY_listener_name =

 

If you Listener.log is growing very big, fast and is too huge, you need to you control the amount of logging or rotate the logs.
You will have to figure out what level is appropriate for you and change it with lsnrctl or directly in the listener.ora.

You can disable the listener from logging by issuing the set log_status command from the lsnrctl command line prompt:
LSNRCTL> set current_listener my-listener
LSNRCTL> SET LOG_STATUS OFF

Note: if ADMIN_RESTRICTIONS_LISTENER is set to ON in your listener.ora you will hit “TNS-12508: TNS:listener could not resolve the COMMAND given” with “SET LOG_STATUS OFF”. Turning it off and you’ll be OK :)

Additionally, you can edit the LISTENER.ORA file and add this line: LOGGING_my-listener = OFF. This will do the same thing.

 

Author: Vincent Fenoll
Compatible: Oracle 10g, 11g, 12c

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.