Full Database Offline Backup

For offline backups, the database needs to be shut down and restarted in mount mode. The database does not have to be in archivelog mode.

Here’s a shell script for an Oracle9i database that shuts down the database, mounts it, backs it up, and opens it:

#!/bin/ksh

rman target / <<EOF
shutdown immediate;
startup mount;
backup database format 
  '/d99/rmanback/brdstn/rman_%d_%t_%U.bus';
alter database open;
EOF
exit

The following shell script takes a full backup of an Oracle8i database. Notice that the command syntax is a little more verbose than that needed for Oracle9i. For Oracle8i, the syntax requires you to place the allocate and backup commands within the run{} command.

#!/bin/ksh

rman target / nocatalog <<EOF
shutdown immediate;
startup mount;
run {
allocate channel d1 type disk;
backup database format 
  '/d99/rmanback/brdstn/rman_%d_%t_%U.bus';
}
alter database open;
EOF
Exit

Note

We’ve used the format parameter in both examples to provide a specific location and unique name for the backup pieces. If the format parameter is not used, the backup pieces will be directed to $ORACLE_HOME/dbs. Please refer to Table 1-1 in the Section 1.9 section.

Get Oracle RMAN Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.