RE: archiving listener log

  • From: <Joel.Patterson@xxxxxxxxxxx>
  • To: <Mayen.Shah@xxxxxxxxxx>, <rjoralist2@xxxxxxxxxxxxxxxxxxxxx>
  • Date: Wed, 18 May 2011 10:34:36 -0400

It seems like the simplest of what was shows so far.   Possible loss of a write 
to an 'inode'? between move and log_status switch.   Could be more detailed 
issues involved with that, don't know.

The last algorithm in email thread I read here did not loose writes, but 
collected them in an 'old log file' during the switch... so assuming a switch 
once/week, you would see some weekly writes being collected there, until the 
day someone deleted it or purged it manually.

That's the tricky part about the listener log rotation.   You don't wish any 
monitoring software to react, or users to have to retry a connection attempt, 
nor 'ideally' loose any data.  The data the is kept is kept in chronological 
order as per logfile_name<date> would indicate.

The process I started was complicated due to auditing purposes and passwords 
(for what its worth... probably not in most cases).  But does work and 
accomplishes all the goals of not loosing data, and all data is in the files as 
indicated by date in order, and the listener catches all incoming requests.

But when possible, I am an advocate of the simpler the better, and if you can 
miss one or two lines in the log file and live with that, then you have a good 
solution.

Joel Patterson
Database Administrator
904 727-2546

________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Mayen.Shah@xxxxxxxxxx
Sent: Tuesday, May 17, 2011 10:51 AM
To: rjoralist2@xxxxxxxxxxxxxxxxxxxxx
Cc: oracle-l@xxxxxxxxxxxxx; oracle-l-bounce@xxxxxxxxxxxxx
Subject: archiving listener log

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: