Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Purging alert log files

Re: Purging alert log files

From: David Barbour <david.barbour1_at_gmail.com>
Date: Mon, 22 Jan 2007 11:59:45 -0500
Message-ID: <69eafc3f0701220859n4534871er8a505306000ca0a1@mail.gmail.com>


I rotate them once a month. Scheduled as a cron job to execute the first minute of every month. Add a line to zip the file. I just didn't get around to it yet.

##########################################################
# Rotate Oracle Alert Log at the beginning of each Month
##########################################################

00 00 1 * * /usr/local/scripts/oracle/rotate_alertlog.sh

"rotate_alertlog.sh" 52 lines, 849 characters #!/bin/ksh

# Script to rotate alert log at the beginning of each month # DAB 09/30/06 # Set local variables

export ORACLE_HOME=/oracle/PR1/920_64
export ORACLE_SID=PR1
export PATH=$PATH:$ORACLE_HOME/bin

# Change to the directory where the alert log is located.

`cd /oracle/PR1/saptrace/background`

currentMonth=`date +%m`

case "$currentMonth" in

   01)
     fileTag="Dec";;
   02)
     fileTag="Jan";;
   03)
     fileTag="Feb";;
   04)
     fileTag="Mar";;
   05)
     fileTag="Apr";;
   06)
     fileTag="May";;
   07)
     fileTag="Jun";;
   08)
     fileTag="Jul";;
   09)
     fileTag="Aug";;
   10)
     fileTag="Sep";;
   11)
     fileTag="Oct";;
   12)
     fileTag="Nov";;
esac

#print $currentMonth
#print $fileTag

`mv /oracle/PR1/saptrace/background/alert_PR1.log /oracle/PR1/saptrace/background/alert_PR1_$fileTag.log`

exit

On 1/22/07, Kline.Michael <Michael.Kline_at_suntrust.com> wrote:
>
> How often are you purging(and cutting copies of) alert logs???
>
>
>
>
>
> Currently we are doing this to purge our log file. For a while on some
> boxes they were doing this all the time so that our "backup" directory had
> may be hundreds of "alert logs" with time stamps. Of course if you wanted to
> "grep" for something you could, but often that gave so many hits that needed
> to be ignored as old alertlog copies didn't count.
>
>
>
> Larger alert logs, 1 year or so, allow us to look to see if this happened
> in the past.
>
>
>
> Also, I'm thinking there is a strong possibility that we could lose data
> on this. I've seen it sometimes take 5-15 seconds just to tail the alert
> log.
>
>
>
> Currently:
>
> cp $LOG_NAME $LOG_NAME.prev
>
> /usr/bin/gzip -c $LOG_NAME.prev > $ORA_LOG/$ORACLE_SID"_"$LOG_NAME"_"`date
> +%H:%M_%d-%h-%Y`.gz
>
> cat /dev/null > $LOG_NAME
>
>
>
> Maybe should:
>
> cp $LOG_NAME $LOG_NAME.prev
>
> cat /dev/null > $LOG_NAME
>
> /usr/bin/gzip -c $LOG_NAME.prev > $ORA_LOG/$ORACLE_SID"_"$LOG_NAME"_"`date
> +%H:%M_%d-%h-%Y`.gz
>
>
>
> I also usually purge once per year, or maybe once per month. On one test
> box, we "rotate" when we refresh the database.
>
>
>
>
>
>
>
> Michael Kline
> Tel: 804.261.9446 Net: 643.9446
>
> Cell: 804.744.1545
> michael.kline_at_suntrust.com
>
>
>
>
>
> LEGAL DISCLAIMER
> The information transmitted is intended solely for the individual or
> entity to which it is addressed and may contain confidential and/or
> privileged material. Any review, retransmission, dissemination or other use
> of or taking action in reliance upon this information by persons or entities
> other than the intended recipient is prohibited. If you have received this
> email in error please contact the sender and delete the material from any
> computer.
>
> SunTrust and Seeing beyond money are federally registered service marks of
> SunTrust Banks, Inc.
> [ST:XCL]
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Jan 22 2007 - 10:59:45 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US