Brian Lane wrote:
>
> Hi all,
> Does anyone have any Sun Unix scripts for doing Oracle hot backups.
> We have just found out that our current backup srategy is inconsistant and
> now the s... has hit the fan.
>
> Regards
> Brian
Brian,
This is a subset of a script I use for the task. The same idea is
applied to every tablespace. Note that the DB is running in ARCHIVELOG
mode.
#!/bin/sh
#
# This script invokes the Oracle Server Manager (command-line) and makes
# a hot, on-line backup of the following files:
#
# a) *.dbf (i.e. Oracle database files)
# b) *.ctl (i.e. Oracle control files)
# c) *.arc (i.e. Oracle archived redo log files)
#
# The steps are as follows:
#
# Switch redo log groups so that the current one can be archived and
copied to tape.
# Place tablespace in backup mode
# Compress tablespace's datafile to *.Z file on Volume 14
# Place tablespace in normal mode
# Copy control file to Volume 14 and compress it
# Copy control file to USER_DUMP_DEST directory
# Copy archived redo log files to Volume 14 and compress them
# Copy all compressed files to tape
#
# By: Simon Goland
# On: Mar 24, 1997
#
# Set some env variables to make typing life easier
#
BK=oradata/ldbc/backup; export BK
EX=/export/share; export EX
#
$ORACLE_HOME/bin/svrmgrl << EOF
connect internal
#
# Switch redo log groups
alter system switch logfile;
#
# Backup LDBC_LARGE tablespace
# No disk space for a copy, so do a direct compress.
#
alter tablespace ldbc_large begin backup;
!compress -c $EX/vol12/oradata/ldbc/ldbc_large01.dbf >
$EX/vol14/$BK/ldbc_large01.dbf.Z
alter tablespace ldbc_large end backup;
# ...
# ...
# ...
#
# Copy Control Files
#
alter database backup controlfile to '$EX/vol14/$BK/control01.ctl';
!compress -v $EX/vol14/$BK/control01.ctl
#
# Make Control File Copy to USER_DUMP_DEST location
#
alter database backup controlfile to trace;
#
# Copy Archived Redo Logs
# Note: Archived redo log files are deleted when they are 10 days or
older by a cron job
#
!cp $EX/vol11/oradata/ldbc/arch/*.arc $EX/vol14/$BK
#
# Compress all archive redo log files
#
!compress -v $EX/vol14/$BK/*.arc
#
# Copy to off-line tape backup
#
!tar cvf /dev/rmt/0c $EX/vol14/$BK/*.Z
exit
EOF
--
[ Simon Goland B-)> sg_at_mda.ca ]
[ Without action there is no change ]
Received on Wed Apr 09 1997 - 00:00:00 CDT