Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: limit alertSID.log file size
<fitzjarrell_at_cox.net> wrote in message
news:1105329729.383829.254580_at_c13g2000cwb.googlegroups.com...
>
> Matthias Wirtz wrote:
>> Hi,
>>
>> due to problems on one oracle box the alertSID.log file was growing
> pretty
>> heavily. So I was checking if there is a limit for this log file or
> will it
>> 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
>
Is it necessary to create an empty alertlog file after the removal ? Won't Oracle create a new one itself ? Received on Mon Jan 10 2005 - 14:03:44 CST
![]() |
![]() |