-----Original Message-----
I want to write unix script to automate archved logs backup to tape ...
After hot backup of data files is completed...

Within script how do I skip archived log file that is being written by
oracle?
-------------------------------------------------------

Here is my crontab entry (paste it back together).  The "70" means start a
backup if the archive directory hits 70% full.  This does NOT run around the
time when the normal backup is running.

0,30 1-18 * * * /oracle/app/oracle/admin/dbascripts/rman/check_arch_dir.ksh
70 >> /oracle/app/oracle/admin/dbascripts/rman/arch_debug 2>&1

Here is my script (which calls the backup script)

----- Snip --------------------------------------
#!/bin/ksh

PERCENT1=`/usr/bin/df -k /z01 | /usr/bin/nawk 'NR == 2 {print
substr($5,1,match($5,"%")-1)}'`
PERCENT2=`/usr/bin/df -k /z02 | /usr/bin/nawk 'NR == 2 {print
substr($5,1,match($5,"%")-1)}'`
PERCENT3=`/usr/bin/df -k /z03 | /usr/bin/nawk 'NR == 2 {print
substr($5,1,match($5,"%")-1)}'`
PERCENT4=`/usr/bin/df -k /z04 | /usr/bin/nawk 'NR == 2 {print
substr($5,1,match($5,"%")-1)}'`

PERCENT1=`echo "$PERCENT1" | /usr/bin/sed 's/[^0-9]*//g'`
PERCENT2=`echo "$PERCENT2" | /usr/bin/sed 's/[^0-9]*//g'`
PERCENT3=`echo "$PERCENT3" | /usr/bin/sed 's/[^0-9]*//g'`
PERCENT4=`echo "$PERCENT4" | /usr/bin/sed 's/[^0-9]*//g'`

if [ -z "$PERCENT1" ]; then PERCENT1=0; fi
if [ -z "$PERCENT2" ]; then PERCENT2=0; fi
if [ -z "$PERCENT3" ]; then PERCENT3=0; fi
if [ -z "$PERCENT4" ]; then PERCENT4=0; fi

if [ $PERCENT1 -gt $PERCENT2 ]; then
   PERCENT=$PERCENT1
else
   PERCENT=$PERCENT2
fi

if [ $PERCENT3 -gt $PERCENT ]; then
   PERCENT=$PERCENT3
fi

if [ $PERCENT4 -gt $PERCENT ]; then
   PERCENT=$PERCENT4
fi

THRESHOLD="$1"
if [ -z "$THRESHOLD" ]; then
   THRESHOLD=50
fi
if [ $PERCENT -gt $THRESHOLD ]; then
   /oracle/app/oracle/admin/dbascripts/rman/backup.ksh ARCH ALL >>
/oracle/app/oracle/admin/dbascripts/rman/debug 2>&1
fi

exit 0
---------- Snip --------------------------

The backup.ksh script is a 1559 line big boy I wrote to automate a lot of
stuff and do a lot checking and verifying.  I don't think you want to see
it.  One thing that might be of interest is a C (not PERL!) frontend I wrote
to make SUID oracle so a non-oracle operator can start a backup by hand if
needed without us opening the permissions on any of our security-sensitive
areas.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephen Lee
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to