Oracle Backupand Recovery
Oracle Backupand Recovery
Oracle Backupand Recovery
January 2000
SE-0001-L LAB: Oracle Backup and
Prepared by Inside SE Group Recovery Using Legato
Contents NetWorker
Objectives...............................3
Configuration Options..........3
Hardware and Software
Installation.............................4
Abstract:
Prepare the Target Database5 This technical guide is a lab designed to introduce the reader to
Run the Target Database in
Archive Mode........................6
practical aspects of installation and configuration of Oracle, RMAN,
Prepare the Recovery EBU and the Legato NetWorker Enterprise Application Module for
Catalog Database..................7 Oracle. It provides step-by-step instructions on how to set up and
Create the Recovery Catalog9 configure Oracle and Legato NetWorker. Oracle Parallel Server is
Register the Target Database9 not within the scope of this document.
Verify and Use RMAN.........10
Set Up Scheduled Backup. 13 This technical guide is written for an audience with a working
Additional Files to Backup.14 knowledge of NetWorker and the NT or Solaris operating system.
Appendix A: Recovery
Manager Script Examples. .15 Database administration experience is useful, but not required.
Appendix B: Sample .ora
files.......................................20
Appendix C: Sample
nsrdmo.sh............................24
Appendix D: Supplemental
Documentation....................35
Appendix E: Notes................36
LAB: Oracle Backup and Recovery Using Legato NetWorker 2
Notice
The information in this publication is subject to change without notice and is provided “AS IS” WITHOUT
WARRANTY OF ANY KIND. THE ENTIRE RISK ARISING OUT OF THE USE OF THIS
INFORMATION REMAINS WITH RECIPIENT. IN NO EVENT SHALL LEGATO BE LIABLE FOR
ANY DIRECT, CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE OR OTHER DAMAGES
WHATSOEVER (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
PROFITS, BUSINESS INTERRUPTION OR LOSS OF BUSINESS INFORMATION), EVEN IF
LEGATO HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
The limited warranties for Legato products are exclusively set forth in the documentation accompanying
such products. Nothing herein should be construed as constituting a further or additional warranty.
This publication does not constitute an endorsement of the product or products that were tested. The
configuration or configurations tested or described may or may not be the only available solution. This test
is not a determination or product quality or correctness, nor does it ensure compliance with any federal
state or local requirements.
Product names mentioned herein may be trademarks and/or registered trademarks of their respective
companies.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 3
Objectives
This technical guide describes backup and recovery of Oracle via RMAN/EBU, NMO and Legato
NetWorker. After reading this guide you should be able to:
Perform the following types of RMAN backups:
Whole database backup-- A backup of all datafiles and control files
Tablespace backup--A backup of a single tablespace
Datafile backup--A backup of a single datafile
Control file backup--A backup of the control files
Archive log file backup--A backup of the archive log files
Perform a cold backup of those files not protected by RMAN/EBU
Perform a cold (offline) backup of the catalog database
Perform the following restore/recovery operations on the target database:
Restore full backup, archive logs, and recover the target database
Perform database point-in-time recovery of the target database
Tablespace point-in-time recovery of the target database is beyond the scope of this
document. Due to the complex nature of tablespace point-in-time recovery, Oracle
recommends that you contact and work with Oracle Worldwide Customer Support
Services before performing a tablespace point-in-time recovery.
Perform a restore of the catalog database
Configuration Options
In this document, the terms Oracle target database, Oracle catalog database, and NetWorker
Server refer to logical roles and not to specific physical systems. A single physical system can be
assigned more than one of these roles.
The minimum recommended configuration is to run the Networker Server, and the Oracle catalog
database on the same machine and run the Oracle target database on a different machine. In an
ideal configuration each of these components would be on a separate system.
The catalog database should only be installed on the same system as the target database for
demonstration or testing purposes. Such a configuration is strongly discouraged in production
environments for performance and recoverability reasons. If the catalog database must be
installed on the same system as the target database it should be created in its own Oracle instance
and reside on separate storage from the catalog database.
Although RMAN does not require a Recovery Catalog, Oracle recommends using a Recovery
Catalog. As of this writing, NMO does not support rman in no recovery catalog mode. The use
of RMAN in no recovery catalog mode is beyond the scope of this document.
Advanced RMAN features such as incremental backup and recovery, parallel backup and
recovery and point-in-time tablespace recovery are only available in Oracle8 Enterprise Edition.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 4
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 5
Verify LISTENER.ORA
From the target database server, execute the following:
C:\oracle\ora81> lsnrctl status
Verify TNSNAMES.ORA’
From the target database server, execute the following:
C:\oracle\ora81> tnsping tar
Note: Although some Oracle documentation illustrates granting SYSDBA privilege to the rman user, the
recovery catalog owner only needs connect, resource, and recovery_catalog_owner privileges. It does not
require dba, sysdba, or sysoper privileges.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 6
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 7
Update TNSNAMES.ORA
Update the tnsnames.ora on the target and catalog database servers such that they both have
entries for the target and catalog databases. See Appendix B for an example of tnsnames.ora.
Verify LISTENER.ORA
From the catalog database server, execute the following:
BIN> lsnrctl status
Verify TNSNAMES.ORA’
From the catalog database server, execute the following:
BIN> tnsping cat
BIN> tnsping tar
If you cannot tnsping the target database from the catalog database server, verify the tnsnames.ora entries
on the catalog database server for the target database.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 8
Note: Although some Oracle documentation illustrates granting SYSDBA privilege to the rman user, the
recovery catalog owner only needs connect, resource, and recovery_catalog_owner privileges. It does not
require dba, sysdba, or sysoper privileges.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 9
Oracle 8.1.5
BIN> rman80 target rman/rman@tar rcvcat rman/rman@cat
Recovery Manager: Release 8.1.5
RMAN-06005: Connected to Target Database: TAR
RMAN-06008: Connected to Recovery Catalog Database
3) RMAN will perform an automatic resync before executing commands such as ‘backup’ and
‘restore’. It is recommended that you resync the catalog at least once a day. To manually resync
the Target Database control file with Catalog Database
RMAN> resync catalog;
4) If you have not executed the ”register database” command prior to executing the ‘resync catalog’
command you will get the following error:
RMAN-20001: target database not found in recovery catalog
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 10
3. Verify that NMO was installed correctly by executing a manual backup to NetWorker:
rman target rman/rman@tar rcvcat rman/rman@cat
RMAN> run{
2> allocate channel T1 type ‘SBT_TAPE”;
3> backup current controlfile;
4> }
4. Type <CTRL-C> to terminate
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 11
Items to be backed up
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 12
EXAMPLE
RMAN> replace script backup_database {
1> allocate channel t1 type ‘SBT_TAPE’;
2> backup database;
3> }
RMAN> run {
1> execute script backup_database;
2> }
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 13
Modify nsrdmo
Verify that the following environment variables are set correctly within the nsrdmo script on the
target database server. A complete nsrdmo.sh with these values highlighted is included in
Appendix C.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 14
Parameter Files
C:\Oracle\ADMIN\<sid>\pfile\init.ora
Password Files
orant\dbs\orapw<SID>
Configuration Files
%oracle_home%\network\admin\listener.ora
%oracle_home%\network\admin\tnsnames.ora,
%oracle_home%\network\admin\sqlnet.ora
…
Oracle Binaries
Operating System Files
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 15
The following scripts use Recovery Manager commands to backup, restore and recover the
database. These scripts have not been verified for accuracy.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 16
(current controlfile
format 'cf_%U');
}
Whole Database and Archive Log Backup – the whole ball of wax
run {
allocate channel T1 type 'SBT_TAPE' format 'full_%U';
backup database;
sql 'alter system archive log current'; #flush online logs to archive
backup archivelog all delete input;
}
Recover Database
Note: Any missing redo logs will be implicitly restored during recovery.
run {
allocate channel D1 type 'SBT_TAPE';
recover database;
sql "alter database open resetlogs";
}
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 17
Restore Control File, Database, Archive Logs, and Recover the Database
The database to be restored needs to be closed. Use Server Manager to
close the database:
run {
allocate channel T1 type 'sbt_tape';
restore controlfile;
replicate controlfile;
sql "alter database mount" ;
restore database;
recover database;
sql "alter database open resetlogs";
}
NLS_LANG=american
NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'
run {
allocate channel T1 type 'sbt_tape';
set until time 'Feb 1 2000 13:00:00'
restore controlfile;
replicate controlfile;
sql "alter database mount" ;
restore database;
recover database;
sql "alter database open resetlogs";
}
Useful Parameters
Environment Variables
Environment variables can be set for an individual channel allocation by using the ‘parms’
parameter:
allocate channel T1 type "SBT_TAPE"
parms "ENV=(<env_variable>=<value>,…)";
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 18
Handling Errors
The “set maxcorrupt” clause determines how many corrupt blocks “backup” tolerates.
allocate channel T1 type 'SBT_TAPE';
set maxcorrupt 5;
Incremental Backups
Incremental levels 0-4 are supported by RMAN. A level 0 of a file or tablespace must be
performed prior to any other incremental backup level. A non-level 0 backup of a file or
tablespace that does not have a previous level 0 backup will fail.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 19
run {
allocate channel dev1 type 'sbt_tape';
backup incremental level 0 # all blocks
database;
}
run {
allocate channel dev1 type 'sbt_tape';
backup incremental level 1 # blocks changed since the last
# level 1 or 0
database;
}
run {
allocate channel T1 type 'sbt_tape';
backup incremental level 2 # blocks changed since the last
# level 2, 1 or 0
database;
}
run {
allocate channel T1 type 'sbt_tape';
backup incremental level 2 cumulative # blocks changed since last
# level 1 or 0
database;
}
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 20
#
# Copyright (c) 1991, 1998 by Oracle Corporation
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation to help you customize
# your RDBMS installation for your site. Important system parameters
# are discussed, and example settings given.
#
# Some parameter settings are generic to any size installation.
# For parameters that require different values in different size
# installations, three scenarios have been provided: SMALL, MEDIUM
# and LARGE. Any parameter that needs to be tuned according to
# installation size will have three settings, each one commented
# according to installation size.
#
# Use the following table to approximate the SGA size needed for the
# three scenarious provided in this file:
#
# -------Installation/Database Size------
# SMALL MEDIUM LARGE
# Block 2K 4500K 6800K 17000K
# Size 4K 5500K 8800K 21000K
#
# To set up a database that multiple instances will be using, place
# all instance-specific parameters in one file, and then have all
# of these files point to a master file using the IFILE command.
# This way, when you change a public
# parameter, it will automatically change on all instances. This is
# necessary, since all instances must run with the same value for many
# parameters. For example, if you choose to use private rollback segments,
# these must be specified in different files, but since all gc_*
# parameters must be the same on all instances, they should be in one file.
#
# INSTRUCTIONS: Edit this file and the other INIT files it calls for
# your site, either by using the values provided here or by providing
# your own. Then place an IFILE= line into each instance-specific
# INIT file that points at this file.
#
# NOTE: Parameter values suggested in this file are based on conservative
# estimates for computer memory availability. You should adjust values upward
# for modern machines.
#
###############################################################################
db_name = cat
instance_name = cat
service_names = cat
db_file_multiblock_read_count = 8 # INITIAL
# db_file_multiblock_read_count = 8 # SMALL
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 21
# db_file_multiblock_read_count = 16 # MEDIUM
# db_file_multiblock_read_count = 32 # LARGE
java_pool_size = 20971520
log_checkpoint_interval = 10000
log_checkpoint_timeout = 1800
processes = 59 # INITIAL
# processes = 50 # SMALL
# processes = 100 # MEDIUM
# processes = 200 # LARGE
parallel_max_servers = 5 # SMALL
# parallel_max_servers = 4 x (number of CPUs) # MEDIUM
# parallel_max_servers = 4 x (number of CPUs) # LARGE
# Uncommenting the line below will cause automatic archiving if archiving has
# been enabled using ALTER DATABASE ARCHIVELOG.
# log_archive_start = true
# log_archive_dest_1 = "location=C:\Oracle\oradata\cat\archive"
# log_archive_format = "%%cat%%T%TS%S.ARC"
# Global Naming -- enforce that a dblink has same name as the db it connects to
global_names = true
# Edit and uncomment the following line to provide the suffix that will be
# appended to the db_name parameter (separated with a dot) and stored as the
# global database name when a database is created. If your site uses
# Internet Domain names for e-mail, then the part of your e-mail address after
# the '@' is a good candidate for this parameter value.
# db_domain = us.acme.com # global database name is db_name.db_domain
# Uncomment the following line if you wish to enable the Oracle Trace product
# to trace server activity. This enables scheduling of server collections
# from the Oracle Enterprise Manager Console.
# Also, if the oracle_trace_collection_name parameter is non-null,
# every session will write to the named collection, as well as enabling you
# to schedule future collections from the console.
# oracle_trace_enable = true
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 22
oracle_trace_collection_name = ""
# define directories to store trace and alert files
background_dump_dest = C:\Oracle\admin\cat\bdump
user_dump_dest = C:\Oracle\admin\cat\udump
db_block_size = 2048
remote_login_passwordfile = exclusive
os_authent_prefix = ""
# The following parameters are needed for the Advanced Replication Option
job_queue_processes = 2
job_queue_interval = 10
open_links = 4
distributed_transactions = 500
mts_dispatchers = "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
# Uncomment the following line when your listener is configured for SSL
# (listener.ora and sqlnet.ora)
# mts_dispatchers = "(PROTOCOL=TCPS)(PRE=oracle.aurora.server.SGiopServer)"
mts_servers = 1
compatible = 8.1.0
Example tnsnames.ora
%oracle_home%\network\admin
TAR.LEGATO.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vonbraun)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = tar)
)
)
CAT.LEGATO.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vonbraun)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = cat)
)
)
Example listener.ora
%oracle_home%\network\admin
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(ADDRESS_LIST =
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 23
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = c:\Oracle\Ora81)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = tar)
(ORACLE_HOME = C:\Oracle\Ora81)
(SID_NAME = TAR)
)
(SID_DESC =
(GLOBAL_DBNAME = cat)
(ORACLE_HOME = C:\Oracle\Ora81)
(SID_NAME = CAT)
)
)
Example sqlnet.ora
%oracle_home%\network\admin
NAMES.DEFAULT_DOMAIN = legato.com
SQLNET.AUTHENTICATION_SERVICES= (NTS)
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 24
#
# Configuration variables, modifiable by users.
#
#
# Variable: ORACLE_BKUPCMD
# Default value: none (utility specific)
# Description: Specifies the Oracle backup utility command.
# This variable must be configured in order to run backup.
#
# If running EBU 2.2, this value is ebu.
# If running EBU pre-2.2 or EBU 2.2 in compatibility mode,
# this value is obackup.
# If running RMAN 8.0, this value is rman (unix) or rman80 (NT).
#
ORACLE_BKUPCMD=
#
# Variable: RMAN_HOME
# Default value: none (site specific)
# Description: Specifies where RMAN home directory is, typically $ORACLE_HOME.
# This variable must be configured in order to locate the executable.
#
# If running EBU, this variable must NOT be set.
#
#
RMAN_HOME=
#
# Variable: RMAN_USE_CAT
# Default value: True
# Description: Specifies whether RMAN Recovery Catalog is used.
# Possible values are either True or False. Setting this variable
# is optional when running RMAN.
# This variable is not supported for EBU.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 25
#
RMAN_USE_CAT=True
#
# Variable: RMAN_CAT_KEYWORD
# Default value: none
# Description: RMAN command keyword, i.e. "rman rcvcat user/pw@catDB" or
# "rman nocatalog"
# Possible values are either rcvcat or nocatalog. This variable is
# required when running RMAN.
# This variable is not supported for EBU.
#
RMAN_CAT_KEYWORD=rcvcat
#
# Variable: RMAN_CAT_TNS
# Default value: none (site specific)
# Description: TNS alias for the recovery catalog database that is specified
# when starting RMAN.
#
# Oracle recommends that the recover catalog be in a separate database from
# the target database. Therefore, in this configuration, the TNS alias name
# is needed to specify the correct database. Setting the -R option will
# override this value.
#
# This variable is not supported for EBU.
#
RMAN_CAT_TNS=
#
# Variable: RMAN_TARGET_KEYWORD
# Default value: none
# Description: RMAN command keyword, i.e. "rman target user/pw@targetDB"
# Possible value is target. This variable is defined in case Oracle changes
# the keyword. It is required when running RMAN.
# This variable is not supported for EBU.
#
RMAN_TARGET_KEYWORD=target
#
# Variable: RMAN_TARGET_TNS
# Default value: none (site specific)
# Description: TNS alias for the target database.
#
# Oracle recommends that the recover catalog be in a separate database from
# the target database. Therefore, in this configuration, the TNS alias name
# is needed to specify the correct database. Setting the -T option will
# override this value.
#
# This variable is not supported for EBU.
#
RMAN_TARGET_TNS=
#
# Variable: RMAN_CMDFILE_KEYWORD
# Default value: none
# Description: RMAN keyword to indicate using command file,
# i.e. "rman target user/pw@targetDB cmdfile db1.bck"
# Possible value is cmdfile. This variable is defined in case Oracle changes
# the keyword. It is required when running RMAN.
# This variable is not supported for EBU.
#
RMAN_CMDFILE_KEYWORD=cmdfile
#
# Variable: RMAN_MSGLOG_KEYWORD
# Default value: none
# Description: RMAN keyword to indicate using output message log,
# i.e. "rman target user/pw@targetDB cmdfile db1.bck msglog rman.log"
# Possible value is msglog. This variable is defined in case Oracle changes
# the keyword.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 26
#
# This variable is not supported for EBU.
#
RMAN_MSGLOG_KEYWORD=msglog
#
# Variable: RMAN_USE_MSGLOG
# Default value: True
# Description: specifies whether to use an output message log.
# Possible values are either True or False.
# This variable is not supported for EBU.
#
RMAN_USE_MSGLOG=True
#
# Variable: RMAN_APPEND_KEYWORD
# Default value: none
# Description: RMAN keyword to indicate appending to specified message log,
# i.e. "rman target user/pw@targetDB cmdfile db1.bck msglog rman.log append"
# Possible value is append. This variable is defined in case Oracle changes
# the keyword.
#
# Note that not setting this variable does NOT turn off append mode.
# To do so, use RMAN_USE_APPEND variable.
#
# This variable is not supported for EBU.
#
RMAN_APPEND_KEYWORD=append
#
# Variable: RMAN_USE_APPEND
# Default value: True
# Description: Specifies whether to use append mode for message logs.
# Possible values are either True or False. Setting this variable
# is optional when running RMAN.
# This variable is not supported for EBU.
#
RMAN_USE_APPEND=True
#
# Variable: OBK_HOME
# Default value: none (site specific)
# Description: Specifies where the Enterprise Backup Utility home directory
# is, typically $ORACLE_HOME/obackup. This variable must be configured in order
# to locate the obackup executable.
#
# If running EBU 2.0.10, 2.0.12.4, or 2.1. setting this variable is required
# If running EBU 2.2 and you intend to use obackup compatibility mode then
# setting this variable is required.
# If running EBU 2.2 and you do not intend to use obackup compatibility mode
# then do setting this variable is not recommended.
#
#
OBK_HOME=
#
# Variable: TMPDIR
# Default value: /tmp
# Description: Specifies the temporary directory for obackup to use.
# If this is not set, obackup tries to use '/' to store temporary files.
#
# TMPDIR=/tmp
#
# Variable: EBU_HOME
# Default value: none (site specific)
# Description: Specifies where the Enterprise Backup Utility home directory
# is, typically $ORACLE_HOME/obackup. This variable must be configured in order
# to locate the ebu executable.
#
# If running EBU 2.2 setting this variable is required
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 27
#
# Variable: ORACLE_HOME
# Default value: none (site specific)
# Description: Specifies where the Oracle Server installation is located.
# This variable can be set here to provide a default value if it is not
# specified with the -H option to nsrdmo on the backup command. Setting
# the -H option will override this setting.
#
# If running EBU 2.2 or RMAN, setting this variable is either set here
# or with the -H option to this script on the backup command is required
#
# If running EBU 2.0.10, 2.0.12.4, or 2.1. setting this variable is generally
# not required.
#
ORACLE_HOME=
#
# Variable: ORACLE_SID
# Default value: none (site specific)
# Description: Specifies the SID of the database being backed up.
# This variable can be set here to provide a default value if it is not
# specified with the -S option to nsrdmo on the backup command. Setting
# the -S option will override this setting.
#
# If running EBU 2.2 setting this variable is either set here or with the
# -S option to this script on the backup command is required
#
# If running EBU 2.0.10, 2.0.12.4, or 2.1. this variable is generally not
# recommended.
#
ORACLE_SID=
#
# Variable: NLS_LANG
# Default value: AMERICAN_AMERICA.US7ASCII
# Description: The Oracle7 Enterprise Backup Utility requires that this
# parameter is set if you are running against a database that does not
# use this character set by default.
#
# If setting this variable you may also need to set ORACLE_HOME in this
# script to allow obackup to locate the message catalog.
#
# Setting this variable is not generally required.
#
#NLS_LANG=AMERICAN_AMERICA.US7ASCII
#
# Variable: PRECMD
# Default value: NONE
# Description: A command to run before backup is started. This variable
# can be used to run a command before oracle backups is started.
#
# The pre command must return a non zero exit code if it fails. It is
# the resposibility of the script writer to ensure that the script
# returns the proper exit code. Please refer chapter 5 of the "BusinesSuite
# Module for Oracle Administrator's Guide, Oracle7 (UNIX)" for templates and
# examples.
#
# Setting this variable is optional.
#
PRECMD=
#
# Variable: POSTCMD
# Default value: NONE
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 28
#
# Variable: NSR_DATA_VOLUME_POOL
# Default value: none
# Description: If this variable is set to name a media pool, then database
# backups will be directed to the named media pool. By default all BMO
# backups will be directed to the 'Default' pool. You can set this
# variable here to provide an alternate default value if a specific pool
# is not specified by savegrp
#
# This variable is either set here or the value can be passed on the -b
# option to savegrp
#
# Setting this variable is optional.
#
NSR_DATA_VOLUME_POOL=
#
# Variable: NSR_NO_BUSY_ERRORS
# Default value: FALSE
# Description: If this variable is set to a value of TRUE then DMO will
# will fail immediately if it encounters a busy server while initializing
# the session.
# If this variable is not set DMO will fail immediately
#
# Setting this variable is optional.
#
NSR_NO_BUSY_ERRORS=FALSE
#
# Variable: NSR_CHECKSUM
# Default value: FALSE
# Description: This environment variable specifies checksumming
# is performed on the data.
# If this variable is set DMO will use checksumming.
#
# Setting this variable is optional.
#
NSR_CHECKSUM=FALSE
#
# Variable: NSR_ENCRYPTION
# Default value: FALSE
# Description: This environment variable specifies encryption
# is performed on the data.
# If this variable is not set DMO will not use encryption by default.
#
# Setting this variable is optional.
#
NSR_ENCRYPTION=FALSE
#
# Variable: NSR_COMPRESSION
# Default value: FALSE
# Description: This environment variable specifies compression
# is performed on the data.
# If this variable is not set DMO will not use compression by default.
#
# Setting this variable is optional.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 29
#
NSR_COMPRESSION=FALSE
#
#
# Variables: BRD_TOT_TIME, BRD_SAMP_TIME, BRD_ERR_TIME, BRD_RETRIES
# Description: The noted environment variables allow the user to
# configure the EBU Instance Manager (brd). The default settings for these
# variables as specified by Oracle are not compatible with scheduled saves
# from NetWorker where obackup starts a new brd process. If brd is started
# using the default values for these variables then savegrp will appear to
# appear to hang before backing up the indexes. The following settings
# will prevent the described behaviour by causing brd to exit seconds after
# the backup is completed.
#
# resist the urge to modify these variables.
#
#
# Variable: BRD_TOT_TIME
# Default value: 300
# Oracle Default value: 172800
# Description: Once the Instance Manager (brd) becomes idle, it will wait for
# BRD_TOT_TIME seconds for any activity by obackup before it exits.
# Caution: setting this value too low may cause brd to exit before obackup
# can establish a connection to the Backup Catalog. If this happens obackup
# will fail with the following error:
# OBK-2464: Internal error. Instance Manager process was not started
#
BRD_TOT_TIME=300
#
# Variable: BRD_SAMP_TIME
# Default value: 1
# Oracle Default value: 300
# Description: The Instance Manager (brd) checks the Backup Catalog for any
# active jobs in the interval of BRD_SAMP_TIME seconds.
#
BRD_SAMP_TIME=1
#
# Variable: BRD_ERR_TIME
# Default value: 1
# Oracle Default value: 900
# Description: If the Instance Manager (brd) detects an error it waits
# BRD_ERR_TIME before retrying the catalog.
#
BRD_ERR_TIME=1
#
# Variable: BRD_RETRIES
# Default value: 1
# Oracle Default value: 3
# Description: The Instance Manager (brd) looks for active jobs BRD_RETRIES
# number of times before going to sleep.
#
BRD_RETRIES=1
# Variable: PATH
# Default value: all platforms
# Description: Set up PATH environment variable. This must be configured
# to include path to the NetWorker program "mminfo" and /usr/bin.
# This variable must be configured to locate the correct executables
#
# HP-UX 10.x
#PATH=/opt/networker/bin:/usr/bin
# Solaris
#PATH=/bin:/usr/sbin:/usr/bin
# AIX
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 30
#PATH=/usr/bin
# Digital UNIX
#PATH=/usr/opt/networker/bin
# All Platforms
PATH=/bin:/usr/sbin:/usr/bin:/opt/networker/bin:/usr/networker/bin:/usr/opt/networker/bin
#
# Variable: NSR_DEBUG_FILE
# Default value: /tmp/bmo.dbg
# Description: To enable debugging output for DMO set the following to
# an appropriate path and file name.
#
# Setting this variable is for debugging purposes only
#
NSR_DEBUG_FILE=/tmp/bmo.dbg
#
# export_environment_variables()
# Make sure that approriate environment variables are exported.
#
#
export_environment_variables()
{
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 31
export NSR_GROUP
export VERBOSE
export PRECMD
export POSTCMD
export PATH
export SHLIB_PATH
# ---------------------------------------------------------------------
# WARNING
# User modifications below this point are not recommended or supported.
# ---------------------------------------------------------------------
#
# Shell and environment variables not configured by user.
#
echo=echo # echo command
Pid=0 # Which process to kill when we are cancelled
#
# usage(): display correct usage for nsrdmo
#
usage()
{
${echo} \
"This command should only be executed by savegroup."
${echo} \
"usage: $0 [<options>]
nsrdmo Options:
[ -H oracle_home ] [-S oracle_sid ] [-T target_TNS] [-R catalog_TNS]
savgrp Options:
[ -BEiLnqvx ] [ -s server ] [ -N name ] [ -e expiration ]
[ -f dirfile ] [ -b pool ] [ -F file ] [ -g group ]
[ -l level ] [ -t date ] [ -m masquerade ] [ -W width ] [ path ... ]
#
# Process arguments supplied by savegrp. Must handle any arguments save(8)
# accepts.
#
# Sample list of arguments
# save -s empire -g Default -n -LL -m empire -l full -W78 -N /usr /usr
#
processargs()
{
while [ $# -gt 0 ]; do
case "$1" in
-H ) # Oracle home
ORACLE_HOME=$2
shift
shift
;;
-S ) # Oracle SID
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 32
ORACLE_SID=$2
shift
shift
;;
-T ) # target TNS
RMAN_TARGET_TNS=$2
shift
shift
;;
-R ) # recovery catalog TNS
RMAN_CAT_TNS=$2
shift
shift
;;
-s ) # Specify server
NSR_SERVER=$2
shift
shift
;;
-B ) # Force connecting directory information
Bflag=y
shift
;;
-E ) # Estimate save set size
Eflag=y
shift
;;
-i ) # Ignore any directives
iflag=y
shift
;;
-LL ) # Force local backup and cause extra line to be printed
LLflag=y
shift
;;
-n) # No save
nflag=y
shift
;;
-q ) # Quiet
qflag=y
shift
;;
-v ) # Verbose
VERBOSE=1
shift
;;
-N ) # Save set name
Saveset_name=$2
shift
shift
;;
-e ) # Specify alternate expiration time
NSR_SAVESET_EXPIRATION=$2
shift
shift
;;
-f ) # Specify directives
Directives=$2
shift
shift
;;
-b ) # Specify pool
NSR_DATA_VOLUME_POOL=$2
shift
shift
;;
-F ) # Specify file for modification time comparison (not used)
Directives=$2
shift
shift
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 33
;;
-g ) # Specify group
NSR_GROUP=$2
shift
shift
;;
-l ) # Specify level
Level=$2
shift
shift
;;
-t ) # Specify time for comparison
Comparison_time=$2
shift
shift
;;
-m ) # Masquerade as another program
Masquerade=$2
shift
shift
;;
-W ) # Specify width of output
Output_width=$2
shift
shift
;;
*) # Name of the obackup script
obk_commands=$1
shift
;;
esac
done
}
#
# backup_oracle: run obackup to backup the oracle database
# The particulars of the backup are contained in the obackup
# command script which is passed to obackup
# nsrobkstart must be on the PATH.
#
backup_oracle()
{
if [ $obackup_status != 0 ]; then
echo "nsrobkstart returned error of "$obackup_status
fi
}
#
# The main portion of this shell.
#
# Process arguments, export environment
# Execute obackup backup
processargs $*
#
# savegrp cancellations - can't handle it here
#
# Both EBU and RMAN backups cannot be stopped
# by killing the processes. In EBU 2.2, ebutool is used. In pre-2.2 EBU,
# a cancel script is used. In RMAN, the channel process (not the rman
# process) has to be killed. The channel process can be queried from
# an Oracle table using a command ID that is set in the backup script.
# Therefore, our code can't find out what the channel PID is.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 34
#
#trap handle_signal 2 15
#
# Export all environment variables.
#
export_environment_variables
#
# Handle database backup
#
backup_oracle
exit $obackup_status
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 35
Refer to the following supplemental documentation to obtain the detailed information required to
fully and properly implement this backup and recovery solution.
SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 36
Appendix E: Notes
Default Oracle Accounts
internal/oracle
sys/change_on_install
system/manager
scott/tiger
Comments
In Oracle 8.1.5 'rcvcat' is deprecated syntax, and has been replaced
with 'catalog': rman target internal/oracle@tar CATALOG rman/rman@cat
The Media Manager considers the backup piece name as the `file name backed up', so this name
must be unique in the Media Manager catalog.
Warning: When a backup generates a file whose name already exists in the Media Manager's
catalog, the original file having that name is deleted.
You can use the following substitution variables to make unique format strings:
%c - copy instance
%d - database name (uppercase)
%n - padded database name.
%t - backup set stamp
%s - backup set number
%p - piece number in the set
%u - an 8 character id composed of compressed representations of the backup set number and
the time the backup set was created
%U – (Default) Generate a unique filename format
SE-0001-L