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: Archived logs backup

RE: Archived logs backup

From: Stephen Lee <slee_at_dollar.com>
Date: Thu, 05 Dec 2002 07:04:01 -0800
Message-ID: <F001.005131AD.20021205070401@fatcity.com>

-----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)

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: slee_at_dollar.com

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: ListGuru_at_fatcity.com (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). Received on Thu Dec 05 2002 - 09:04:01 CST

Original text of this message

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