Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: limit alertSID.log file size
Matthias Wirtz wrote:
> Hi, > > due to problems on one oracle box the alertSID.log file was growingpretty
> hit the file-system limits. > > MAX_DUMP_FILE_SIZE specifies the maximum size of trace files(excluding the
> alert file). So this will be of no help. Any ideas? > > -- > Matthias Wirtz - Norfolk, USA
There is no setting to limit the alert log file size, and, yes, if left unchecked it will expand to the limit of the filesystem. One way of 'limiting' the size of this file on UNIX/Linux is to write a script, scheduled through cron, to obtain the current file size of the log, compare it to your desired 'limit' then move the file to a new name, such as alert<sid>.<mmddyyyy> and compress it:
#!/bin/ksh
#
# alert_log_limit
#
# Limit alert.log size to 100 Mb
#
# ddf 01/09/2005
#
# Set the environment
#
. $HOME/.profile
#
# User-defined variables
#
LOGHOME="$ORACLE_BASE/admin/****/bdump"
LIMIT=104857600 # 100 Mb
ALRTLOG="$LOGHOME/alert_****.log"
NEWLOG="$LOGHOME/alert****.`date '+%m%d%Y'`"
#
# Get the current size of the alert log
#
SIZE=`ls -l $ALRTLOG | awk '{printf "%d\n", $5}'` echo $SIZE
#
# Check if this is greater than or equal to our limit
#
if [ $SIZE -ge $LIMIT ]
then
mv $ALRTLOG $NEWLOG
if [ $? -ne 0 ]
then
echo "Cannot move $ALRTLOG to $NEWLOG"
exit 1
fi
cd $LOGHOME
compress $NEWLOG
if [ $? -ne 0 ]
then
echo "Cannot compress $NEWLOG"
exit 2
fi
fi
#
# Presume all is well, create a new, empty alert log and exit
gracefully
#
touch $ALRTLOG
exit 0
Scheduling a script like the above with cron, during the early hours of the morning, will check the alert log, rename it should it meet or exceed your size limits and compress the moved file to reclaim space. The next entry to the alert log will create a new file, so it is not necessary to create one beforehand. I show the action here because that is how I like to code such scripts. I hope this helps.
David Fizjarrell Received on Sun Jan 09 2005 - 22:02:09 CST