Rotating
database log files is a common and day-to-day practice for DBAs. Rotation of
logs is a process whereby we rename (and archive/compress) current log files so
that new log files get created. Listener’s log file is also part of this
practice because size of listener log file increases very fast, and it may increase
beyond several GBs within a couple of months. If listener log file is not rotated,
this may sometimes cause initial connection to database become slow. Therefore,
this is very important to rotate listener log file. In the following I will
explain how we rotate listener log file.
Listener log file name is same as listener name. Name of default listener is “listener”, hence the log file name is listener.log and it is located under $GRID_HOME/network/log by default. Command “lsnrctl status <listener_name>” also returns you the location of listener log file.
For
rotating listener log, initiate lsnrctl utility, set current_listener to the
listener for which you want to rotate listener log file, disable log_status,
rename or truncate listener log file and in the end enable back log_status.
Following is the sequence of commands.
Set
log_status off
[grid: log]$ lsnrctl The command completed successfully |
See
this document if you face TNS-12508 while setting log_status to off.
Now rename or truncate listener log file at OS level
[grid: log]$ echo '' > listener.log |
Set
log_status back on
[grid: log]$ lsnrctl The command completed successfully |
No comments:
Post a Comment