Thursday 9 October 2014

Oracle listener.log file growing too large


Oracle listener.log file growing too large 



One problem that happens in very active databases is that the listener.log file can get very large.
Often people may overlook this until they stop getting new log messages or the volume/filing system
holding the log file is running out of space.

Remember that on most 32bit operating systems, there is usually a 2gb file size limit.

On most 64bit OS's the file can grow a lot larger, often 1TB for a single file. Sometimes this can be the cause of using
all the available space on a volume.

You may notice that even after you delete the file, the space doesn't come back as being usable.

Specifically, on Unix/Linux - If you delete a file that is open for writing, the space doesn't get freed up
until the process that is writing the file terminates.

Normally if you rename or delete the listener.log file it will create a new file, but it won't free
up the space taken by the old file. This is because the file is open for writing the whole time by the listener.

If you can stop the listener, then rename the file and then restart it all would be fine and normal.
This is not an option for some installations.

If the listener process can not be terminated because of incoming connections needing to be serviced, how would
you handle this? Very common in a 24*7 operational mode.

Here's a procedure that has worked for me in the past:

$ lsnrctl

LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 18-NOV-2011 11:48:59

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> show log_status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "log_status" set to ON
The command completed successfully
LSNRCTL>
LSNRCTL> set log_status off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "log_status" set to OFF
The command completed successfully
quit

Now rename your existing log file to a different name:

Go back into "lsnrctl" and turn logging back on.


$ lsnrctl

LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 18-NOV-2011 11:48:59

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> show log_status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "log_status" set to OFF
The command completed successfully
LSNRCTL>
LSNRCTL> set log_status on
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "log_status" set to ON
The command completed successfully
LSNRCTL> quit

This will keep the listener running and close the file, allowing you to keep operations alive and be able to maintain
the files.

Depending on the operating system you're using files get handled a little differently. This has worked for
windows and for UNIX/Linux.

Hope this helps