Oracle Backupand Recovery

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 36

Technical Guide

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

Hardware and Software Installation


Hardware Installation and Configuration
1. Configure hardware per manufacturer’s instructions.
2. If more than one server is being used, verify that they are attached to the network.
3. Verify that your backup storage device is attached to the NetWorker server.

Operating System Installation and Configuration


1. Install Windows NT Server 4.0 or Solaris 2.6/2.7 on the Oracle target database server, catalog
database server, and NetWorker server. Apply patches as appropriate.
2. If using more than one server is being used, verify that they can reach each other via TCP/IP.
3. Verify that any required backup storage device drivers are loaded and that the devices can be
accessed by the operating system.

Oracle Software Installation


1. Install the same version of Oracle on both the Oracle target database server and the catalog
database server.
2. Do not install the LSM option. Normally, Oracle 8i automatically makes this decision based
it’s detection of NetWorker components. This can be specified manually using the custom
install option.

Legato Software Installation


For detailed information about installing Legato Networker, refer to the Legato NetWorker
Installation Guide, and the NMO installation guide.
1. Install Legato NetWorker Server on the backup server.
2. Install the Legato NetWorker Client and Legato NetWorker Enterprise Application Module
for Oracle on the Oracle target database server.
3. Install the Legato NetWorker Client on the Oracle catalog database server.
4. Apply NetWorker Server, Client and NMO patches as needed to all systems.

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 5

Prepare the Target Database


Create Target Database

Oracle 8.1.5 for NT


1. Launch Database Configuration Assistant.
2. Select ‘Create a database’ and ‘Next’
3. Select ‘Typical’ and ‘Next’
4. Select ‘Copy existing database files from the CD’ and ‘Next’
5. Enter the ‘Global Database Name’ e.g. ‘TAR’
6. Enter the ‘SID’ e.g. ‘TAR’
7. Select ‘Finish’
8. This will take several minutes

Create TNSNAMES.ORA & LISTENER.ORA

Oracle 8.1.5 for NT


The Database Configuration Assistant created entries for the target database when the database was
created.

Verify LISTENER.ORA
From the target database server, execute the following:
C:\oracle\ora81> lsnrctl status

Should see: TAR has 1 service handler

Verify TNSNAMES.ORA’
From the target database server, execute the following:
C:\oracle\ora81> tnsping tar

Create a Target Database User


This is only required for scheduled backup with NetWorker. The Target Database User must be the same
as the Catalog Database User (e.g. rman.) This is a Legato restriction.
BIN> svrmgrl (Oracle 8.1.5)
SVRMGR> connect internal/oracle
SVRMGR> create user rman identified by rman

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

Run the Target Database in Archive Mode


In order to perform hot (online) backups, the database has to be running in archive mode.
1. To enable archive logging, add the following to the init.ora file on the Oracle target database
server. (Location, Oracle 8.1.5 for NT: C:\ORACLE\ADMIN\<sid>\pfile\init.ora)
LOG_ARCHIVE_START = true
2. OPTIONAL: Set the destination of the archive logs, add the following to the init.ora file on
the Oracle target database server. (Up to five LOG_ARCHIVE destinations are allowed.)
LOG_ARCHIVE_DEST_1 = "location=<archive_log_path_1>"
LOG_ARCHIVE_DEST_2 = "location=<archive_log_path_2>"
. . .
3. OPTIONAL: Set the format of the archive logs, add the following to the init.ora file on the
Oracle target database server. Consult Appendix E for a list of formatting variables.
LOG_ARCHIVE_FORMAT = Arc%s.%t
4. Run the following commands from the Server Manager (SVRMGRL) as ‘internal’:
SVRMGR> connect internal/oracle
SVRMGR> Shutdown normal
SVRMGR> Startup mount
SVRMGR> Alter database archivelog;
SVRMGR> shutdown
SVRMGR> Startup
5. Verify that the database is started in archive mode by typing the command:
SVRMGR> archive log list;

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 7

Prepare the Recovery Catalog Database


Recovery Catalog Guidelines
1. For performance and recoverability reasons, do not create the recovery catalog in the target
database instance. Create a separate database with datafiles on different disks.
2. Take appropriate measures to insure that the recovery catalog is backed up.

Create Recovery Catalog Tablespace


[Oracle8: Backup and Recovery Workshop Vol. 2 – Student Guide, Oct 1998 p 9-19]
SVRMGR> connect internal/oracle
SVRMGRL> create tablespace rcvcat datafile '<directory>/<file>'
2> size 20M autoextended on next 20M maxsize 50M;

e.g. ‘<directory>/<file>’ = ‘c:\ORACLE\ORADATA\cat\rcvcat.dbf’

Create TNSNAMES.ORA & LISTENER.ORA

Oracle 8.1.5 for NT


The Database Configuration Assistant created entries for the catalog database when the database was
created.

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

Should see: CAT has 1 service handler

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.

Create Recovery Catalog Database

Oracle 8.1.5 for NT


1. Launch Database Configuration Assistant.
2. Select ‘Create a database’ and ‘Next’
3. Select ‘Typical’ and ‘Next’
4. Select ‘Copy existing database files from the CD’ and ‘Next’

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 8

5. Enter the ‘Global Database Name’ e.g. ‘CAT’


6. Enter the ‘SID’ e.g. ‘CAT’
7. Select ‘Finish’
8. This will take several minutes

Create a Catalog Database User


This is only required for scheduled backup with NetWorker. The Catalog Database User must be the same
as the Target Database User (e.g. rman.) This is a Legato restriction. You might need to login as ‘internal’
to create a database user.
SVRMGR> connect internal/oracle
SVRMGR> create user rman identified by rman
2> default tablespace rcvcat
3> temporary tablespace temp
4> quota unlimited on rcvcat;

Grant Privileges To The Catalog Database User


Give the catalog database user the privileges needed to maintain and query the recovery catalog:
SVRMGR> connect / as sysdba (what does this do?)
SVRMGR> grant connect, resource to rman;
SVRMGR> grant recovery_catalog_owner to rman;

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

Create the Recovery Catalog


Connect as the new user to the Recovery Catalog Database and populate the recovery catalog tablespace:

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

RMAN> create catalog

Oracle 8.0.x for UNIX


[Oracle8: Backup and Recovery Workshop Vol. 2 – Student Guide, Oct 1998 p 9-20]
SVRMGR> connect rman/rman@cat
SVRMGR> @$ORACLE_HOME/rdbms/admin/catrman.sql

Oracle 8.0.x for NT


SVRMGR> connect rman/rman@cat
SVRMGR> @%ORACLE_HOME%/rdbms80/admin/catrman.sql

Register the Target Database


1) Initiate RMAN session to the Target Database and Recovery Catalog
[Oracle8: Backup and Recovery Workshop Vol. 2 – Student Guide, Oct 1998 p 9-25]
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

2) Use ‘register’ to register Target Database


[Oracle8: Backup and Recovery Workshop Vol. 2 – Student Guide, Oct 1998 p 10-5]
RMAN> register database;
.
.
.
RMAN-08006: Database registered in Recovery Catalog
RMAN-03023: executing Command: Full Resync
.
.
.
RMAN-08004: Full Resync Complete

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

Verify and Use RMAN


Verify RMAN Configuration
1. Verify RMAN was configured correctly by executing a backup to disk:
rman target rman/rman@tar rcvcat rman/rman@cat
RMAN> run{
2> allocate channel D1 type disk format ‘<directory>/%U’;
3> backup current controlfile;
4> }
2. OPTIONAL: Clean up the backup file(s) in <directory>
e.g. ‘<directory>/%U’ = ‘c:\temp\%U’

Verify NMO Installation


1. Create a client resource for the target database system on the NetWorker server.
2. Set Up DB_Domain (Oracle 8.1.5 only)
a. Add the following line to the init.ora file:
DB_Domain=<domain>

e.g. <domain> = legato.com

b. Verify with tnsping:


tnsping tar.legato.com
tnsping cat.legato.com

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

Determine the MML


If the rman script compiles correctly, you will see the rman message ‘RMAN-08526’ near the
beginning of the output. This message identifies the media management library (MML) that is in
use. Examples are listed below:
Correct:
RMAN-08030: allocated channel: T1
RMAN-08500: channel T1: sid=8 devtype=SBT_TAPE
RMAN-08526: channel T1: MMS Version 2.1.2.0
Incorrect:
RMAN-08030: allocated channel: T1
RMAN-08500: channel T1: sid=18 devtype=SBT_TAPE
RMAN-08526: channel T1: VERITAS NetBackup for Oracle8 - Release 3.2GA

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 11

If the MML is incorrect

Oracle 8.x for NT:


Upon instance startup, Oracle will load the first orasbt.dll it locates in the path into memory. By
default NMO installs orasbt.dll to ‘c:\winnt\system32’.
Locate and rename all instances of orasbt.dll on the catalog database server and reinstall NMO.
After you install NMO, you will need to restart Oracle to load the new orasbt.dll into memory.

Oracle 8.1.5 for Unix


Update the symbolic link to the library (8.1.5) (Refer to NMO documentation.)
Check the link to /usr/lib/libobk.so (solaris), or /usr/lib/libobk.su (hpux)

Oracle 7.x and 8.0.x for Unix


Re-link the library into the Oracle binary. (Refer to NMO documentation.)
You can check which MML was linked into the Oracle binary by using one of the following
depending on your platform:

sun: /usr/bin/ldd $ORACLE_HOME/bin/oracle


hpux: /usr/bin/chart $ORACLE_HOME/bin/oracle
tru64: /usr/bin/odump –Dl $ORACLE_HOME/bin/oracle
aix: /usr/bin/dump –H $ORACLE_HOME/bin/oracle
sgi: /usr/bin/elfdump –Dl $ORACLE_HOME/bin/oracle
lnx86: /usr/bin/ldd $ORACLE_HOME/bin/oracle

Items to be backed up

Item Backup method


Online redo logs Not backed up. Backup archive redo logs instead.
Archive redo logs RMAN and NMO
Datafiles RMAN and NMO
Control files RMAN and NMO
Parameter Files Networker Client
C:\Oracle\ADMIN\<sid>\pfile\init.ora
Password Files Networker Client
orant\dbs\orapw<SID>
Configuration Files Networker Client
%oracle_home%\network\admin\listener.ora
%oracle_home%\network\admin\tnsnames.ora,
%oracle_home%\network\admin\sqlnet.ora

Oracle Binaries Networker Client
Operating System Files Networker Client

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 12

Create Custom RMAN Script


RMAN scripts can be called in three ways:
1. Interactively – scripts entered manually from the rman session (as in the tests above.)
2. Using command files – scripts stored as files on the filesystem. The filename of an
RMAN command file typically ends with ‘.rcv’
rman target rman/rman@tar rcvcat rman/rman@cat cmdfile <scriptname>
OR
rman target rman/rman@tar rcvcat rman/rman@cat
RMAN> @<scriptname>
3. Using stored scripts – scripts stored in the catalog database.
RMAN> create script <scriptname> {}
RMAN> replace script <scriptname> {}
RMAN> print script <scriptname>;
RMAN> delete script <scriptname>;
RMAN> run { execute script <scriptname>; }

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> }

Refer to Appendix A for sample scripts.

List RMAN Backup Instances


RMAN> list backup;

List Unrecoverable Datafiles


The following command lists all datafiles that cannot be completely recovered from the existing
backups.

RMAN> report unrecoverable;

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 13

Set Up Scheduled Backup


Set Up NetWorker Client Resource
Set up a client resource for the target database server on the NetWorker server that has the
following settings:
Saveset: <RMAN script filename>
Remote user: <rman user>
Password: <rman password>
Backup Command: nsrdmo.sh/nsrdmo.bat
Note on levels: Only NetWorker levels of “full” or “skip” are supported. The actual backup
level is set within the rman script.

Create RMAN user


Since the remote user value specifies the userid that savefs and nsrdmo will execute under in
addition to specifying the user name with which to connect to the target and catalog database
instances, you must create an operating system user with the same name.
Create the RMAN operating system user on the target database server if you have not already
done so.

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.

Environment Variable Use with Use with EBU


RMAN
ORACLE_BKUPCMD YES YES
RMAN_HOME YES NO
RMAN_CAT_TNS YES NO
RMAN_TARGET_TNS YES NO
OBK_HOME NO YES
EBU_HOME NO YES
ORACLE_HOME YES YES
ORACLE_SID YES Not Recommended
NSR_DATA_VOLUME_POOL Optional Optional
NSR_SERVER Optional Optional
NSR_CLIENT Optional Optional

Start The Group


Start the group manually either via the GUI or the command line.

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 14

Additional Files to Backup


Although RMAN protects the most important Oracle files, there are several files that it does not
protect. Not the least of which is it’s own catalog database. Typically, a client instance for the
target and client database server will be configured with the “All” saveset in order to protect these
files. Judicious use of directives will avoid an inconsistent and redundant backup of those files
on the target database server that are being protected by RMAN (such as datafiles, control files
and redo logs.) Typically, the catalog database instance is stopped prior to backup, backed up,
and then restarted after backup. Obviously, any RMAN backups that rely on this catalog will fail
if the catalog database is unavailable.

Additional Target DB files to back up


The following files are not backed up by rman and should be backed up via the Networker Client:

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

Additional Catalog DB files to back up


Typically, the catalog DB is backed up cold. This means that appropriate pre and post processing
will need to be applied in order to stop and restart the database (see the ‘save’ manpage for
information on savepnpc.) Be sure to back up the following files up via the Networker Client:

Online redo logs


Archive redo logs
Datafiles
Control files
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

Appendix A: Recovery Manager Script


Examples

The following scripts use Recovery Manager commands to backup, restore and recover the
database. These scripts have not been verified for accuracy.

Backup Script Examples

Whole Database Backup – a backup of all datafiles and control files


run {
allocate channel T1 type 'SBT_TAPE' format 'db:tar_%U';
backup database;
}

Tablespace Backup – a backup of a single tablespace


run {
allocate channel T1 type 'SBT_TAPE';
backup (tablespace system,user
format 'ts:system_ts:user_%U');
}

Datafile Backup – a backup of a single datafile


run {
allocate channel dev1 type 'sbt_tape';
backup
(datafile 'c:\ORACLE\ORADATA\tar\system01.dbf'
format 'df:system.dbf_%U');
}

Control File Backup – a backup of the control files


Note: In Oracle 8, the current control file is automatically backed up when the first datafile of the
system tablespace is backed up. The current control file can also be explicitly included in a
backup or backed up individually.

Backup of the control file and an individual tablespace


run {
allocate channel dev1 type 'sbt_tape';
backup
(tablespace user include current controlfile
format 'ts:user_cf_%U');
}

Backup of just the control file


run {
allocate channel dev1 type 'sbt_tape';
backup

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 16

(current controlfile
format 'cf_%U');
}

Archive Log Backup – a backup of the archive log files


run {
allocate channel T1 type 'SBT_TAPE' format 'logs_%U ';
sql 'alter system archive log current'; #flush online logs to archive
backup archivelog all delete input;
}

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;
}

Restore/Recover Script Examples

Restore Database Only


run {
allocate channel T1 type 'SBT_TAPE';
restore database;
}

Restore Archive Logs Only


run {
allocate channel T1 type 'SBT_TAPE';
restore archivelog;
}

Restore Database, Archive Logs, and Recover the Database


run {
allocate channel T1 type 'SBT_TAPE';
restore database;
restore archivelog;
recover database;
sql "alter database open resetlogs";
}

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:

SVRMGR> shutdown abort;


SVRMGR> startup nomount;

run {
allocate channel T1 type 'sbt_tape';
restore controlfile;
replicate controlfile;
sql "alter database mount" ;
restore database;
recover database;
sql "alter database open resetlogs";
}

Database Point In Time Recovery


The database to be restored needs to be closed. Use Server Manager to
close the database:

SVRMGR> shutdown abort;


SVRMGR> startup nomount;

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";
}

Tablespace Point In Time Recovery


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.

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

e.g. ‘<env_variable>=<value>’ = NSR_CLIENT=oracle.legato.com

Designate Destination of a Backup to Disk


The destination of a backup to a device type of disk is defined with the ‘format’ parameter.
allocate channel T1 type disk format '<directory>/<file>'

e.g. ‘<directory>/<file>’ = ‘c:\temp\%U’

The default destination is:


UNIX: $ORACLE_HOME/dbs/%U,
NT: %ORACLE_HOME%\DATABASE\%U

Create Multiple Datastream copies


Use the “set duplex” clause to generate multiple copies of a datastream.
set duplex=<#copies>;
allocate channel T1 type 'SBT_TAPE' format 'full_%U';

Channel Control commands


The following example illustrates the use of channel control commands to set the maximum data
rate, backup piece size, and number of open files for a given channel.
allocate channel T1 type 'SBT_TAPE';
set limit channel T1 readrate=200; #readrate in buffers/second
set limit channel T1 kbytes=204800; #limit backup piece size
set limit channel T1 maxopenfiles=64; #max. number of open files

Handling Errors
The “set maxcorrupt” clause determines how many corrupt blocks “backup” tolerates.
allocate channel T1 type 'SBT_TAPE';
set maxcorrupt 5;

Forcing Channel Selection


run {
allocate channel T1 type 'SBT_TAPE';
allocate channel D1 type disk;
backup
# channel T1 backs up current control file to tape
(current controlfile
channel T1)
# channel D1 backs up current control file to disk
(current controlfile
channel D1)
}

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

Differential Incremental Backups


A differential incremental backup contains only blocks that have been changed since the most recent
backup at the same level or lower.

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;
}

Cumulative Incremental Backups


A cumulative incremental backup at level n contains only blocks that have been changed since the most
recent backup at level n-1 or lower. Compare the following example with the previous one.

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

Appendix B: Sample .ora files


Example init.ora
C:\Oracle\ADMIN\<sid>\pfile\init.ora

#
# 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_files = 1024 # INITIAL


# db_files = 80 # SMALL
# db_files = 400 # MEDIUM
# db_files = 1500 # LARGE

control_files = ("C:\Oracle\oradata\cat\control01.ctl", "C:\Oracle\oradata\cat\


control02.ctl")

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

db_block_buffers = 8192 # INITIAL


# db_block_buffers = 100 # SMALL
# db_block_buffers = 550 # MEDIUM
# db_block_buffers = 3200 # LARGE

shared_pool_size = 15728640 # INITIAL


# shared_pool_size = 3500000 # SMALL
# shared_pool_size = 5000000 # MEDIUM
# shared_pool_size = 9000000 # 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

log_buffer = 32768 # INITIAL


# log_buffer = 32768 # SMALL
# log_buffer = 32768 # MEDIUM
# log_buffer = 163840 # LARGE

#audit_trail = true # if you want auditing


#timed_statistics = true # if you want timed statistics
max_dump_file_size = 10240 # limit trace file size to 5M each

# 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"

# If using private rollback segments, place lines of the following


# form in each of your instance-specific init.ora files:
# rollback_segments = (r01, r02, r03, r04)

# If using public rollback segments, define how many


# rollback segments each instance will pick up, using the formula
# # of rollback segments = transactions / transactions_per_rollback_segment
# In this example each instance will grab 40/5 = 8
# transactions = 40
# transactions_per_rollback_segment = 5

# 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

# C:\ORACLE\ORA81\NETWORK\ADMIN\TNSNAMES.ORA Configuration File:C:\Oracle\Ora81\network\


admin\tnsnames.ora
# Generated by Oracle Net8 Assistant

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

# C:\ORACLE\ORA81\NETWORK\ADMIN\LISTENER.ORA Configuration File:C:\Oracle\Ora81\network\


admin\listener.ora
# Generated by Oracle Net8 Assistant

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

(ADDRESS = (PROTOCOL = TCP)(HOST = vonbraun)(PORT = 1521))


)
)
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = vonbraun)(PORT = 2481))
)
)

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

# C:\ORACLE\ORA81\NETWORK\ADMIN\SQLNET.ORA Configuration File:C:\Oracle\Ora81\network\


admin\sqlnet.ora
# Generated by Oracle Net8 Assistant

NAMES.DEFAULT_DOMAIN = legato.com

SQLNET.AUTHENTICATION_SERVICES= (NTS)

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 24

Appendix C: Sample nsrdmo.sh


# nsrdmo
#
# Modification of this script should be done with care and only after reading
# the administration manual included with this product.
#
# This script should only be run as part of a scheduled savegroup.
#
# IMPORTANT NOTE FOR EBU USERS
# The Enterprise Backup Utility executable and process prefixes and suffixes
# are changed from "obk" to "ebu" at EBU 2.2. This script has been modified
# both the old and new nomenclature and also to support enhancements introduced
# in EBU 2.2. This script now accepts, in addition to the regular savegrp
# options, the -H option for ORACLE_HOME, and -S option for ORACLE_SID. If you
# have more than one database you are backing up with EBU 2.2 you can now
# create a separate client resource for each database and call a the nsrdmo
# script with the -H and -S parmameters to specify which database to backup.
# Note that the use of options on the backup command requires NetWorker server
# and client release 5.0 and above.
#
# IMPORTANT NOTE FOR ORACLE8 USERS:
# This script supports running a scheduled savegroup (server initiated
# backups) with the Oracle8 Recovery Manager Utility (RMAN). Note that
# username/passwords are required for the target database and recovery catalog.
# If multiple databases reside on the same client host, then Networker 5.1
# is required to support username/passwords correctly for individual databases.
# The -T option for RMAN_TARGET_TNS and -R option for RMAN_CAT_TNS are
# accepted, for specifying which database and recovery catalog to use without
# having to edit this script.
#
# Returns 0 on success; 1 on failure.
#

#
# 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

# If running EBU 2.0.10, 2.0.12.4, or 2.1. this variable is not supported


#
EBU_HOME=

#
# 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

# Description: A command to run after backup is completed. This variable


# can be used to run a command after oracle backups have completed.
#
# The post 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.
#
POSTCMD=

#
# 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

# For HP-UX only


# Variable: SHLIB_PATH
# Default value: /usr/lib
# obackup requires this variable to be set in order to locate the libobk.sl
# shared library.
#
# This variable should be configured on HP-UX systems.
#
SHLIB_PATH=/usr/lib

#
# 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()
{

# The following variable is required to start backup


export ORACLE_BKUPCMD

# The following variables should always be exported when using RMAN


export RMAN_HOME
export RMAN_USE_CAT
export RMAN_CAT_KEYWORD
export RMAN_CAT_TNS
export RMAN_TARGET_KEYWORD
export RMAN_TARGET_TNS
export RMAN_CMDFILE_KEYWORD
export RMAN_MSGLOG_KEYWORD
export RMAN_USE_MSGLOG
export RMAN_APPEND_KEYWORD
export RMAN_USE_APPEND

# The following variables are requried by EBU 2.2


export EBU_HOME
export ORACLE_HOME
export ORACLE_SID

# The following variable is required by versions other than EBU 2.2


# export NLS_LANG only if it is required.
export OBK_HOME
#export TMPDIR
#export NLS_LANG

# Optional BMO variables


export NSR_COMPRESSION
export NSR_ENCRYPTION
export NSR_CHECKSUM

# The following variables should always be exported even if not set.


export NSR_SERVER
export NSR_SAVESET_EXPIRATION
export NSR_DATA_VOLUME_POOL

SE-0001-L
LAB: Oracle Backup and Recovery Using Legato NetWorker 31

export NSR_GROUP

# The following variables control EBU Instance Manager operation


export BRD_TOT_TIME
export BRD_SAMP_TIME
export BRD_ERR_TIME
export BRD_RETRIES

export VERBOSE
export PRECMD
export POSTCMD

# The following variable is for debugging only.


#export NSR_DEBUG_FILE

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 ... ]

For an explanation of all options, see the save(8) man page.


"
exit 1
}

#
# 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()
{

nsrobkstart $obk_commands &


Pid=$!
wait $Pid
obackup_status=$?

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

Appendix D: Supplemental Documentation

Refer to the following supplemental documentation to obtain the detailed information required to
fully and properly implement this backup and recovery solution.

Legato Networker Documentation


 Refer to the online documentation provided on the Legato Networker CD, including the
Legato Networker Installation Guide, Release 5.5, Windows NT Version

Oracle8i Release 8.1.5 Documentation


 Oracle8i Backup and Recovery Guide Release 8.1.5, which contains detailed information
about backup and recovery procedures for Oracle8i Release 8.1.5
 Documentation provided on the Oracle8i Enterprise Edition CD

Microsoft Windows NT Server Documentation


 Microsoft Windows NT Server Administrator’s Guide

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

Generating Unique File Names


You should use the substitution variables provided by Recovery Manager to generate unique
backup piece names when writing backups to a Media Manager. A backup piece name is
determined by the format string specified either in the backup command, or in the allocate
channel command.

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

You might also like