archiving listener log

  • From: Mayen.Shah@xxxxxxxxxx
  • To: rjoralist2@xxxxxxxxxxxxxxxxxxxxx
  • Date: Tue, 17 May 2011 10:50:43 -0400

I use log_staus to achieve this as below:


YMD=$(date +%Y%m%d_%T)
mv $ORACLE_HOME/network/log/${listener_name}.log   /<archives 
directory>/${listener_name}.log.${YMD}

# Turn listener logging off and on so that listener logging can start

lsnrctl << eof1
     set current_listener  ${listener_name}
     set log_status off
     set log_status on
     exit
eof1

It has been working for years. Does anyone see any issue with this? (I 
just want to find out if I am doing this right or not)

Thank you
Mayen



From:   "Rich Jesse" <rjoralist2@xxxxxxxxxxxxxxxxxxxxx>
To:     oracle-l@xxxxxxxxxxxxx
Date:   05/17/2011 10:42 AM
Subject:        Re: [SOLVED] missing alert.log mystery (it's not what you 
think)
Sent by:        oracle-l-bounce@xxxxxxxxxxxxx



Niall writes:

> In the case of the listener then lsnrctl can be used to rename the log 
file

In unixish, something like this:

# Temporarily change the listener log location
lsnrctl <<EOD1
set log_file listener_OLD
EOD1
# Archive the listener log by renaming
mv $ORACLE_HOME/network/log/listener.log
$ORACLE_HOME/network/log/listener.log_`date +\%y\%m\%d\%H\%M\%S`
# Reset the listener log location
lsnrctl <<EOD2
set log_file listener
EOD2
# Keep two weeks worth.
find $ORACLE_HOME/network/log/*.log_???????????? -mtime +14|xargs -i -t rm 
{}

A cleanup of the ever-growing "listener_OLD" file is in order as well. 
Perhaps a similar rename/purge...

YMMV.  Standard "not my fault" disclaimer applies.  :)

Rich

--
//www.freelists.org/webpage/oracle-l




Other related posts: