Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Archive Log BACKUP Sqripts?
Satar Naghshineh wrote:
> Oracle 7.3.2.2.0 (by the time you read this)
> SunSPARQ20 SunOS 2.5.1
> UNIX 2.5
> Hi there,
> Anyone have a sqript that they can lend me that checks the Archive
> destination (disk) every hour and then copies any Archived Log files
> (*.ARC) to the tape device (dev/rmt/0)?
> Satar Naghshineh
> SatarNag_at_worldsite.com
>
> Thanks in advance!!!!
here is a script...
#!/bin/ksh -vx
# Script to compress and archive log files to tape. # uses fuser to determine nothing is writting to file.
LOG_DIR=$HOME
SUFFIX=arch
SLEEP=2
TAPE=/dev/rmt/0n
if [ -r $LOG_DIR/.chaser.pid ]
then
PID=$(cat $LOG_DIR/.chaser.pid) if [ $(ps -ef | grep $PID | grep -v grep | wc -l) -gt 0 ] then exit 0 # I am already running fi
echo $$ > $LOG_DIR/.chaser.pid
while true
do
if [ -r $LOG_DIR/*.$SUFFIX ] then for i in $LOG_DIR/*.$SUFFIX do if [ -z $(/usr/sbin/fuser $i 2> /dev/null) ] then date > $i.sum ls -l $i >> $i.sum sum $i >> $i.sum compress $i ls -l $i.Z >> $i.sum sum $i.Z >> $i.sum tar cvf /dev/rmt/0 $i.Z $i.sum if [ $? -ne 0 ] then # Write to tape has failed ! exit fi mv $i.Z $i.done.Z mv $i.sum $i.sum.done fi done fi sleep $SLEEP
Cheers
Paul
-- \|||/ O O ------OooO----( )----OooO------------------------------------------ Paul MacPherson System Consultant - Sun Microsystems Canada Inc. ------------------------------------------------------------------- (403) 262-6722 - voice http://www.cadvision.com/pmacpher (403) 205-8633 - pager paul.macpherson_at_canada.sun.com (403) 266-4121 - fax pmacpher_at_cadvision.com -------------------------------------------------------------------Received on Tue Sep 09 1997 - 00:00:00 CDT