newbie backup script question

From: Dave Platt <plattd_at_govonca.gov.on.ca>
Date: Thu, 24 Mar 1994 22:45:55 GMT
Message-ID: <1994Mar24.224555.14553_at_govonca.gov.on.ca>


The following is a backup script, which we plan to run nightly, that our systems integrator says is suffucient to guarantee the integrity of our Oracle database in the event of any type of failure. We are a new Oracle shop and, although we have a lot of faith in out integrator, would like some independant assessments of the plan. Please feel free to comment on any or all aspects of the script.

#! /bin/csh -f
#

setenv ORACLE_SID V6
setenv ORACLE_HOME /usr/people/oracle6
setenv ARCHIVE_HOME /disk6/oracle6/LIMS/archives setenv BACKUP_HOME /disk5/oracle6/LIMS/backups

set dayofweek = `date +%a`
set today = `date +%y%m%d`

if ( $USER != oracle6 ) then
 echo "must be user oracle6 to run this">> backup.log   exit
endif

if ( ! -d /disk5/oracle6/LIMS/backups) then  echo " Require dir /disk5/oracle6/LIMS/backups to run script" >> backup.log  exit
endif

cd /disk5/oracle6/LIMS/backups

echo       MOEE LIMS    backup started `date`                  >> backup.log
echo ----------------------------------------------------      >> backup.log
echo                                                           >> backup.log

if ( -f todays.export ) mv todays.export yesterdays.export

( /usr/people/oracle6/bin/exp system/password FULL=Y FILE=todays.export INDEXES=Y GRANTS=Y CONSTRAINTS=Y >> backup.log ) >>& backup.log echo " weekly export file completed ">> backup.log

#
# Protect against the possibility a new redo log arrives while archiving to
# tape
#

pushd $ARCHIVE_HOME
mv arch*.dbf $BACKUP_HOME
popd
tar cf - arch*.dbf | compress -c > $today.redologs.tar.Z tar cvf /dev/mt/tps0d2nr *.redologs.tar.Z todays.export >> &hot_backup.log

#
# begin tablespace backups to reset archives
#

echo Starting HOT BACKUP of TABLESPACES at `date` >> backup.log /usr/people/oracle6/bin/sqldba << END_sqldba > hot_backup.log connect internal
alter tablespace system begin backup;
!tar cvf /dev/mt/tps0d2nr /usr/people/oracle6/dbs/LIMS/LIMS.dbs alter tablespace system end backup;
alter tablespace data begin backup;
!tar cvf /dev/mt/tps0d2nr /usr/people/oracle6/dbs/LIMS/DATA.dbf alter tablespace data end backup;
alter tablespace seedpak begin backup;
!tar cvf /dev/mt/tps0d2nr /disk4/oracle6/LIMS/dbs/SEEDPAK.dbf alter tablespace seedpak end backup;
alter tablespace archive begin backup;
!tar cvf /dev/mt/tps0d2nr /disk6/oracle6/LIMS/dbs/ARCHIVE.dbf alter tablespace archive end backup;
alter tablespace main_indexes begin backup; !tar cvf /dev/mt/tps0d2nr /disk5/oracle6/LIMS/dbs/INDEXES.dbf alter tablespace main_indexes end backup; alter tablespace workspace begin backup; !tar cvf /dev/mt/tps0d2nr /usr/people/oracle6/dbs/LIMS/WORKSPACE.dbf alter tablespace workspace end backup;
alter tablespace rollbacks begin backup; !tar -cvf /dev/mt/tps0d2nr /disk5/oracle6/LIMS/dbs/ROLLBACKS.dbf alter tablespace rollbacks end backup;
alter database backup controlfile to '$ARCHIVE_HOME/arch_control.dbf'; alter system switch logfile;
disconnect
exit
END_sqldba

#
# remove archive files to free up disk space for new week
#

rm arch*.dbf
rm -f `find $BACKUP_HOME -name \*redologs.tar.Z -mtime +7 -print`

cat hot_backup.log >>backup.log
echo ARCHIVE COMPLETED `date` >> backup.log Received on Thu Mar 24 1994 - 23:45:55 CET

Original text of this message