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 =

 
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.