Chapter 4. On-Demand Backups

Be sure to complete steps in Chapter 3 before performing the procedures in this chapter.

The BusinesSuite Module for Oracle enables you to configure on-demand backups using the Enterprise Backup Utility command-line interface. Command examples presented in this chapter are in C–shell format.

Tip: You should perform an on-demand backup before moving on to Chapter 5.

Performing On-Demand Backups Using the Enterprise Backup Utility

The Enterprise Backup Utility (EBU) connects to NetWorker through the Oracle Tape Backup API, which passes data to NetWorker through a shared library, When you set up a system running the BusinesSuite Module for Oracle as a client of the NetWorker server, several environment variables are configured and passed to the Enterprise Backup Utility.

To perform an on-demand NetWorker backup using the Enterprise Backup Utility command-line interface, you must first provide values for several required NetWorker environment variables. The environment variables can be set through the command–line interface or a script.

On-Demand Backups and NetWorker Indexes

When you use the Enterprise Backup Utility command–line interface to perform an on–demand backup of an Oracle database, the NetWorker client indexes for Oracle and the NetWorker server's bootstrap are not automatically backed up.

Caution: If you never perform scheduled backups using NetWorker and never manually back up the indexes and bootstrap, you will not have backups of the client indexes and server's bootstrap file for use in the event of a catastrophic disaster.

NetWorker Bootstrap Save Set

The bootstrap save set is a special-function save set that NetWorker creates as part of the disaster recovery functionality. The bootstrap save set contains everything needed to recover the configuration database, the media database, and server's index to the point just before the bootstrap was created. From these three components, the complete NetWorker environment can be recovered.

The criteria that NetWorker uses to assess whether or not to create a bootstrap save set reflect the administrator's configuration for scheduled group backups. The criteria ensure that all client and server index files are properly backed up for a successful disaster recovery. To understand the specific criteria that savegrp applies, the role of the bootstrap save set in disaster recovery must be explained.

The NetWorker server's savegrp program, invoked only during a scheduled backup, performs a level 9 backup of the client indexes and the NetWorker server's bootstrap information each time a scheduled backup completes. The client indexes and the server's bootstrap are vital for restoring data to Oracle in the event of a disaster. Performing regular scheduled database backups provides maximum protection for critical data.

After you perform an on-demand backup of Oracle7 Server database objects by means of the Enterprise Backup Utility command-line interface, you may back up the NetWorker server's client indexes and bootstrap manually by invoking the savegrp command line from the NetWorker server:

% savegrp -O -l full -P printer_name -c client_name -c networker_servername 

See the savegrp(1M) reference page for a description of this command and its options.

Required NetWorker Variables for Data Backups

If you do not provide settings for the required Networker BusinesSuite Module for Oracle variables, Enterprise Backup Utility on-demand backups may fail.

Setting the Value for NSR_SERVER

The NSR_SERVER environment variable designates which hostname to use as the NetWorker backup server.

Note: If the NetWorker server machine is different from the Oracle7 database server machine, be sure that the database server is properly configured within NetWorker as a client of the NetWorker server before you export the NSR_SERVER variable at the command line and start your on-demand backups. For example, you can use the NetWorker administration GUI on the NetWorker server and check the Clients window to verify the proper client configuration.

To properly set NSR_SERVER, replace the value networker_servername in the following example with the actual name of the server assigned for NetWorker backups of your Oracle7 Server:

% setenv NSR_SERVER networker_servername 

Tip: If you do not explicitly specify a value for the variable NSR_SERVER before issuing an obackup command, the database module searches the network for a NetWorker server. Set the NSR_SERVER variable to avoid a potential delay in the backup process.

Setting the Value for OBK_HOME

The OBK_HOME environment variable is required by both the Enterprise Backup Utility program obackup and the BusinesSuite Module for Oracle. To set OBK_HOME, replace the value ebu_install_dir in the following example with the actual name of the directory where the Oracle7 Enterprise Backup Utility is installed on your system:

% setenv OBK_HOME ebu_install_dir 

Verifying the Value of NSR_CLIENT

The NSR_CLIENT environment variable is used by the BusinesSuite Module for Oracle only during restores. You should verify that the NSR_CLIENT environment variable is not set during backup. Verify the value of NSR_CLIENT by running the following:

% echo $NSR_CLIENT 

To unset the NSR_CLIENT environment variable, run the following command:

% unset NSR_CLIENT 

See Appendix A, “Environment Variables” for information about the NetWorker BusinesSuite Module for Oracle environment variables and their valid values.

Creating Command Scripts

Your next task is creating a set of command scripts to instruct the Oracle Enterprise Backup Utility to perform on-demand backups. The syntax for running obackup is as follows, where command_script is the name of the command script. The name chosen for the script should be one that reminds you of the operation.

% obackup command_script 

It is recommended that you make a separate directory exclusively for command scripts, because you may be creating many of these scripts and they will be easier to manage if they are grouped together. In this book, /oracle/obackup/scripts is the command script directory. You might also want a separate directory for each database.

Using such command scripts to run obackup from the command line, before using obackup in the more complex automatic “lights-out” fashion with NetWorker, is the best way to try out your Oracle backup system.

The Enterprise Backup Utility stores information and error messages in the log file specified by the log parameter in the command script. It is strongly recommended that the output in this log file be reviewed after each backup job. The log file pathnames used with log parameters in command script examples are for a UNIX systems only.

Note: You must be logged in as oracle owner to use obackup commands for on–demand NetWorker backups.

Performing Offline Backups

Here is a sample offline backup script. This script assumes that the database TARGET01 has been registered previously and that TARGET01 is offline. This sample script is called backup_offline:

backup offline database
db_name = "TARGET01"
oracle_sid = "TARGET01"
log = "/oracle/obackup/logs/offline_db.log"

To run obackup with this script, use the following command:

% obackup backup_offline

The log parameter specifies the log file where the Enterprise Backup Utility stores information and error messages. Review the output in this log file after each backup job. The parallel keyword specifies the number of save sets streamed simultaneously to the NetWorker server.

When an offline backup script successfully completes on a system, it displays the following type of output:

Oracle7 Enterprise Backup Utility: Release
Copyright (c) Oracle Corporation 1979, 1996.  All rights reserved.
CORE Version - Production
NLSRTL Version - Production

Performing Online Backups

For those times when you cannot shut down the database, you will need online backup scripts. Here is a command script named backup_online to back up the database. This script assumes that the database is online:

backup online database
db_name = "TARGET01"
oracle_sid = "TARGET01"
log = "/oracle/obackup/logs/partial_ts1.log"

This command script instructs the Enterprise Backup Utility to back up the database online. To run obackup with this script, use the following command:

% obackup backup_online 

Example of an On-Demand Backup Command

Select a tablespace of manageable size for the sample backup. Then, create a backup script called partial-ts2, as follows. The tablespace being used here is TOOLS.

backup online
db_name = "TARGET01"
oracle_sid = "TARGET01"
tablespace = "TOOLS"
log = "/oracle/obackup/logs/partial-ts2.log"

Invoke the obackup command with the partial-ts2 script that you just created, to back up your database to a labeled backup volume mounted on the NetWorker server:

% setenv NSR_SERVER jupiter 
% setenv OBK_HOME /oracle/obackup 
% obackup partial-ts2 

After backing up the database with this obackup partial-ts2 command, you should back up the NetWorker client indexes and bootstrap manually by running this savegrp command line on the NetWorker server:

% savegrp -O -l full -P printer_name -c client_name -c networker_servername 

For more detailed examples of obackup command scripts, refer to the Oracle7 Enterprise Backup Utility Administrator's Guide.

To perform scheduled backups, see Chapter 5, “Scheduled Backups.”

Performing Archived Redo Log Backups

The Enterprise Backup Utility is configured, by default, to perform a backup of archived redo logs automatically when performing an online backup.

You can also configure the Enterprise Backup Utility to delete the archived redo log files after they have been backed up. This feature can be enabled in a command script with the archdelete specifier.

Note that backing up archived redo log files is not automatically done for offline database backups.

Caution: Archived redo log backups allow you to restore the database to its original state before a disaster occurred. If you do not maintain archived redo log backups and need to recover data, you will only be able to recover your database up to the time of the last backup. In this case, transactions that occurred between the time of the last backup and the time your database was corrupted will be lost. It is strongly recommeded that you leave archivelog enabled if you need continuous protection.

Performing Catalog Backups

The Backup Catalog, stored in the Backup Catalog database, should be backed up after every target database backup.

The best way to back up the Backup Catalog database is with a UNIX script, executed after the target database backup. Use the obkexp shell script provided by Oracle in the Oracle Enterprise Backup Utility distribution for this backup procedure.