Oracle Backup
for UNIX Administrators
Bill Mansfield
Database backup and recovery requires both database administration and
systems administration skills. Sometimes backups are neglected, are not
done in a way that allows recovery, take too long, or become too disruptive.
This article is intended to provide systems administrators with enough
background to find out whether they're getting good backups for their
databases, and if not, provide a starting point for getting them in the
future.
The Korn shell scripts discussed here are typically executed as the
Oracle user. They need to have the authority to read the various tables,
and must have access to read the database files. The database should be
up when you start. Oracle version 8.x is assumed. You'll need to add the
usual code to set ORACLE_HOME and ORACLE_SID, do logging, check return
codes, maintain multiple versions, protect passwords, etc.
Cold (Offline) Backups
In many ways, a cold backup is the simplest solution. Bring the database
down, copy the database and control files, and bring the database back
up. Then use your regular backup software to send the files to tape for
safekeeping. You don't even need archive log files. But, first the script
must ask the database what the necessary files are:
BACKUPDIR=<backup destination> # directory where the saved files go
# get the files to back up, and shut down the database
svrmgrl <<! > /dev/null
connect internal
set termout off
spool /tmp/ctlfiles;
select name from v\$controlfile;
spool off;
spool /tmp/dbfiles;
select name from v\$datafile;
spool off;
shutdown immediate
exit;
!
# Copy the data files.
|