Вы находитесь на странице: 1из 68

CONFIDENTIAL - NOT FOR DISTRIBUTION

Symantec NetBackup
7.x for Oracle
for UNIX
LABS

200-002674-B

COURSE DEVELOPER

Lisa Childress
LEAD SUBJECT MATTER
EXPERTS

Geoff Bergren
Dustin Scharf

TECHNICAL
CONTRIBUTORS AND
REVIEWERS

Copyright 2011 Symantec Corporation. All rights reserved.

John Gerhardson
Lisa Goldring

Copyright 2011 Symantec Corporation. All rights reserved.


Symantec, the Symantec Logo, and VERITAS are trademarks or
registered trademarks of Symantec Corporation or its affiliates in
the U.S. and other countries. Other names may be trademarks of
their respective owners.
THIS PUBLICATION IS PROVIDED AS IS AND ALL
EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS
AND WARRANTIES, INCLUDING ANY IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE
DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH
DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
SYMANTEC CORPORATION SHALL NOT BE LIABLE FOR
INCIDENTAL OR CONSEQUENTIAL DAMAGES IN
CONNECTION WITH THE FURNISHING, PERFORMANCE,
OR USE OF THIS PUBLICATION. THE INFORMATION
CONTAINED HEREIN IS SUBJECT TO CHANGE WITHOUT
NOTICE.
No part of the contents of this book may be reproduced or
transmitted in any form or by any means without the written
permission of the publisher.
Symantec NetBackup 7.x for Oracle for UNIX
Symantec Corporation
World Headquarters
350 Ellis Street
Mountain View, CA 94043
United States
http://www.symantec.com

CONFIDENTIAL - NOT FOR DISTRIBUTION

Appendix A

Copyright 2011 Symantec Corporation. All rights reserved.

NetBackup 7.x for Oracle for UNIX Lab Guide

323

CONFIDENTIAL - NOT FOR DISTRIBUTION

Copyright 2011 Symantec Corporation. All rights reserved.

324

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-2

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Symantec NetBackup 7.x for Oracle for UNIX


Lab Guide
Lab Activities Table of Contents

Copyright 2011 Symantec Corporation. All rights reserved.

Lab #

325

Lab Activity

Page

Oracle Concepts

A-5

Cold Database Backup and Database Restore

A-13

RMAN Concepts and Backup Operations

A-21

Performing Backups Using NetBackup for Oracle and


RMAN

A-35

Simple Restore and Recovery Operations with RMAN and


NetBackup for Oracle (NBUO)

A-47

Managing the RMAN Recovery Catalog

A-51

Advanced Recovery Operations

A-59

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-3

Copyright 2011 Symantec Corporation. All rights reserved.

326

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-4

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab 1: Oracle Concepts

Copyright 2011 Symantec Corporation. All rights reserved.

Lab Setup

327

All of the labs in this course are performed using three virtual machines, as illustrated in
the diagram on this page. One machine serves as the NetBackup master server, media
server, and as the host for the Oracle recovery catalog database (RMANCAT). This
machine is referred to as the master machine, and has a hostname of train1. The
master server system also hosts the OpsCenter Server software in this lab environment.
The second machine serves as the NetBackup client, and as the host for the target
database (ORCL). This is also the machine on which you configure the NetBackup for
Oracle (NBUO) extension. This machine is referred to as the client machine, and has a
hostname of train2. The third virtual machine hosts the virtual tape library (VTL) used
for writing backups to tape, and has a hostname of falconvtl.
Startup of virtual machines
At the start of this lab activity you must start each of the three virtual machines (VMs) in
your lab environment. The virtual machines should be started in the following sequence:
1st falconvtl (the tape library emulation)
2nd train1 (the NetBackup master/media server)
3rd train2 (the ORCL db system and NetBackup client)
CONFIDENTIAL - NOT FOR DISTRIBUTION
Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-5

Copyright 2011 Symantec Corporation. All rights reserved.

328

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-6

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab System Configuration


Record the following information to be provided by your instructor.
Master/Media Server Information
Variable

Example

Lab Value

Master/Media Server Name

master

train1

Master/Media Server OS Version

RedHat Linux 2.6

RedHat Linux 2.6

Master/Media Server Logon


Username

root

root

Master/Media Server Logon


Password

veritas

veritas

Master/Media Server Oracle


Username

oracle

oracle

Master/Media Server Oracle


Password

veritas

veritas

Oracle Instance Name

RMANCAT

RMANCAT

Location of NetBackup software


installation_directory

/usr/openv

/usr/openv

Location of Oracle software


installation directory

/oracle

/u01/oracle

Variable

Example

Lab Value

Client Name

client

train2

Client OS Version

RedHat Linux 2.6

RedHat Linux 2.6

Client Logon Username

root

root

Client Logon Password

veritas

veritas

Master/Media Server Oracle


Username

oracle

oracle

Master/Media Server Oracle


Password

veritas

veritas

Oracle Instance Name

ORCL

ORCL

Location of NetBackup software


installation_directory

/usr/openv

/usr/openv

Location of Oracle software


installation_directory

/oracle

/u01/oracle

Copyright 2011 Symantec Corporation. All rights reserved.

Client Information

329

Robotic Tape Device Information


Robot Type

TLD

Number and Type of Robotic


Drives

2 dlt drives

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-7

Exercise 1: Starting the Oracle Instance

If you have not already done so, start the virtual machines in the following listed below. Wait for
each virtual machine to reach the login prompt before starting the next virtual machine.

1st falconvtl (the tape library emulation)


2nd train1 (the NetBackup master/media server)
3rd train2 (the ORCL db system and NetBackup client)
Note: The steps in Exercise 1 (steps 1 and 2) should be performed on both systems, train1 and
train2, because the master server contains the RMANCAT database instance, and the client
contains the ORCL instance.
Perform steps 1 and 2 on the MASTER (train1) system.

1. Log on to the system as root, then switch user to Oracle user.


# su oracle
$

2. Type env from the Oracle command prompt to view the environment variables.
MASTER $
MASTER $ env
...
HOME=/u01/oracle
...
ORACLE_BASE=/u02/oradata
ORACLE_HOME=/u01/oracle
ORACLE_SID=RMANCAT
...

CLIENT $
CLIENT $ env
...
HOME=/u01/oracle
...
ORACLE_BASE=/u02/oradata
ORACLE_HOME=/u01/oracle
ORACLE_SID=ORCL
...

What is the name of the database instance running on the master machine?

Copyright 2011 Symantec Corporation. All rights reserved.

________________________________________________________________

330

3. Repeat steps 1 and 2 above, on the CLIENT (train2) system.


What is the name of the database instance running on the client machine?
________________________________________________________________

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-8

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 2: Querying the Database


Note: The steps in Exercise 2 (1-4) should be performed on both systems, train1 and train2,
because each system is running an instance of the Oracle database.
Perform steps 1-5 on the MASTER server (train1).

1. Invoke SQL*Plus by typing:


MASTER

CLIENT

MASTER $ sqlpus /nolog

CLIENT $ sqlplus /nolog

The results of this command are:


SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 24
04:14:53 2011
Copyright(c) 1982, 2005, Oracle. All rights reserved.
SQL>

2. From the SQL> prompt, connect to the instance as user sysdba by typing the following
command:
SQL> connect / as sysdba
Connected to an idle instance.

3. Start the database (Note: your values may vary).


SQL> startup
ORACLE instance started.

Copyright 2011 Symantec Corporation. All rights reserved.

Total System Global Area 167772160 bytes


Fixed Size
2019320 bytes
Variable Size
75497480 bytes
Database Buffers
88080384 bytes
Redo Buffers
2174976 bytes
Database mounted.
Database opened.
SQL>

331

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-9

4. Determine the database structure by querying the v$ views. Using the following commands,
what can you determine about:

a. The version of Oracle.


SQL> select * from v$version;
Banner
--------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 Production

b. Data files (remember, these values vary depending upon the Oracle instance name):
SQL> select name from v$datafile;
NAME
--------------------------------------------------/u02/oradata/oradata/<db>/system01.dbf
/u02/oradata/oradata/<db>/undotbs01.dbf
/u02/oradata/oradata/<db>/sysaux01.dbf
/u02/oradata/oradata/<db>/users01.dbf

c. Online redo logs (remember, these values vary depending upon the Oracle instance
name):
SQL> select member from v$logfile;
MEMBER
----------------------------------------------/u02/oradata/oradata/<db>/redo03.log
/u02/oradata/oradata/<db>/redo02.log
/u02/oradata/oradata/<db>/redo01.log

Copyright 2011 Symantec Corporation. All rights reserved.

d. Control files

332

SQL> select value from v$parameter where name =


'control_files';
VALUE
----------------------------------------------------/u02/oradata/oradata/<db>/control01.ctl,
/u02/oradata/oradata/<db>/control02.ctl,
/u02/oradata/oradata/<db>/control03.ctl

e. Alert Log location


SQL> show parameters background_dump_dest;
NAME
TYPE
VALUE
------------------- ----- ---------------------background_dump_dest
string /u02/oradata/admin/<db>/bdump

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-10

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

5. Leave the database open on the MASTER (train1); do not perform a shutdown command.
6. On the master server (train1), type exit, and press Enter, to exit SQL*Plus.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition
Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

7. Repeat steps 1-4 on the CLIENT (train2) system.


8. Leave the database open on the CLIENT, and exit SQL*Plus.
SQL> exit

Lab Summary
This lab exercise provided the steps necessary to start up a database as well as to perform queries
to check the structure and integrity of the database.
In this exercise you:

Copyright 2011 Symantec Corporation. All rights reserved.

333

Logged on to the Oracle server


Started an Oracle instance
Queried the structure of the database using the v$ views

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-11

Copyright 2011 Symantec Corporation. All rights reserved.

334

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-12

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab 3: Cold Database Backup and Database Restore Using


NetBackup
The purpose of this lab is to:

Use NetBackup to perform a cold, consistent backup of an Oracle database.


Use NetBackup to restore the database.
Verify that NetBackup is properly configured.

Note: For the purposes of this lab exercise, the target database is ORCL.

Exercise 1: Performing a Cold Backup of the Database


A cold database backup can be accomplished by configuring and executing a
bpstart_notify script to shut down the database prior to backing it up and a
bpend_notify script to restart the database after the backup.
Perform the following steps on the MASTER machine.

1. Log on to the master as root.


2. Start the NetBackup System Administration Console GUI.
MASTER # /usr/openv/netbackup/bin/jnbSA &
Host Name:
User:
Password:

train1
root
veritas

3. Create a new policy to execute as a manual backup.


a. In the left pane of the Administration Console, select NetBackup Management >
Policies.
b. Select Actions > New > Policy.
c. Name the policy Lab3_coldbackup.
d. Configure the attributes of the Lab3_coldbackup policy using the parameters
shown in Table 1.

Copyright 2011 Symantec Corporation. All rights reserved.

Policy type:
Data classification :

335

Standard
Default
(Instructor will specify)
disk_stu or tape_stu
Oracle (if using tape_stu)
Default
Default
0 (zero)
default
Yes
No
No
No
No

Policy storage:
Policy volume pool:
Take checkpoints
Limit jobs per policy:
Job priority:
Media Owner :
Active:
Follow NFS:
Cross mount points:
Compression
Encryption
Collect disaster recovery information
- NOT
DISTRIBUTION
for Bare MetalCONFIDENTIAL
Restore
No FOR
<deselect>
Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-13

Collect true image restore info:


with move detection:
Allow multiple data streams:
Keyword Phrase :

default
default
No
No
Table 1

e. Set the schedule for the Lab3_coldbackup policy using the parameters shown in
Table 2.
Schedule Name:

Full_Backup

Type of Backup:

Full Backup

Schedule Type:

Default

Destination:

Default

Multiple Copies:

Default

Override policy storage selection :

Default

Override policy volume pool:

Default

Override media owner :

Default

Retention:

Default

Media Multiplexing:

1 (Default)

Window Start

No entry required

Window Duration

No entry required
Table 2

f.

Set the policy to back up files under the /u02/oradata/oradata/ORCL


directory and set the client name to your client hostname train2 (select Linux,
RedHat2.6 as the Hardware and OS for the client).

Copyright 2011 Symantec Corporation. All rights reserved.

Note: The backup window remains closed so the backup job never automatically (and
inadvertently) starts. You will execute this policy as a manual backup only.

336

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-14

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Perform the following steps on the CLIENT machine.


4. Login as root and change to the Oracle user on the client machine.
CLIENT # su oracle

5. Ensure the target database is open.


CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
Connected.
The unqualified Connected response indicates that the database is mounted and open.

6. Shut down the database on the client machine.


SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.

7. On the Master, initiate a manual backup of the database.


a. If necessary, start the NetBackup System Administration Console GUI.
b. MASTER # /usr/openv/netbackup/bin/jnbSA &
c. In the left pane of the NetBackup Administration Console on the master, select
NetBackup Management > Policies.
d. In the All Policies pane of the NetBackup Administration Console, right-click the
Lab3_coldbackup policy and select Manual Backup.
e. Select the Full_Backup schedule.
8. Use Activity Monitor to monitor the backup until it completes successfully with a status code
of 0 (zero).

9. When the backup completes, restart the database on the CLIENT machine.

Copyright 2011 Symantec Corporation. All rights reserved.

SQL> startup
ORACLE instance started.

337

Total System Global Area 1224736768 bytes


Fixed Size
2020384 bytes
Variable Size
318770144 bytes
Database Buffers
889192448 bytes
Redo Buffers
14753792 bytes
Database mounted.
Database opened.
10. Disconnect from the database on the CLIENT system (train2).
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition
Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-15

Exercise 2: Restoring the Database


To perform the database restore, you simulate a disk failure and use NetBackup to restore the
database from the backup you completed in Exercise 1 of this lab.
Note: Before continuing, make absolutely certain that the backup was successful. Verify this with
your instructor before continuing.
Perform the following steps on the CLIENT machine:

1. As user root on the client, simulate a disk failure by removing the database files from the
target database.
CLIENT # cd /u02/oradata/oradata/ORCL
CLIENT # rm *
Note: If necessary, respond y to confirm.

2. Attempt to access the datafiles.


a. Change to the oracle user.
CLIENT # su oracle

(password: veritas)

b. Start SQL*Plus
CLIENT $ sqlplus /nolog

c. Connect to the target database.


SQL> connect / as sysdba

d. Attempt to access the data files.


SQL> select * from dba_data_files;
What happens when you execute this command?

3. Shut down the database and exit SQL*Plus.


Copyright 2011 Symantec Corporation. All rights reserved.

SQL> shutdown abort

338

ORACLE instance shut down.


SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition
Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Note: Because the database files have been deleted, only the shutdown abort command can
close the database.

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-16

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Perform the following steps on the MASTER machine.

4. Using the NetBackup System Administration Console GUI, restore all data files.
a. As user root, launch the NetBackup System Administration Console GUI.
MASTER # /opt/openv/netbackup/bin/jnbSA &

b. From the NetBackup Administration Console, access the Backup, Archive, and
Restore interface, and select the Restore Files tab.
- Select Actions > Specify NetBackup Machines and Policy Type
-

Set the Source client to the NetBackup client, train2.

Set the Destination client to the NetBackup client, train2, and click OK, to close
the Specify NetBackup Machines and Policy Type dialog box.

Set the Restore type to Normal Backups.

The Browse directory should display / only(the root directory).

If the Browse directory does not display /, type / in the field, and press Enter.

c. In the directory structure, navigate to the /u02/oradata/oradata/ORCL


directory and select all files for restore.

d. Click the Restore button.


e. In the Restore Marked Files dialog box, click Restore everything to its original
location.

f. Select Overwrite existing files.


g. Click Start Restore, and answer "Yes" to the "View Progress" message.
5. Monitor the progress of your restore in the Task Progress tab.
Notify your instructor if you encounter errors or problems during the restore.
Perform the following steps on the CLIENT machine:

6. After the restore process completes, start up the restored database on the CLIENT, train2.
CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup

7. Check the database files.


SQL> select * from dba_data_files;

Copyright 2011 Symantec Corporation. All rights reserved.

What happens this time when you execute this command?

339

8. Leave the database open and exit the SQL*Plus.


SQL> exit

9. At the file system prompt on the client, train2, verify that the database files have been
restored to the target database.
CLIENT $ cd /u02/oradata/oradata/ORCL
CLIENT $ ls -l

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-17

Exercise 3: Using NetBackup to Automate Database Shutdown and Startup


Perform the following steps on the CLIENT machine to automate database shutdown and
startup for your cold database backup.

1. Exit from SQL*Plus on the CLIENT, train2, and return to user root.
2. Create a NetBackup shell script to shutdown the database before performing the
backup.
a. Change to the /usr/openv/netbackup/bin/ directory.
CLIENT # cd /usr/openv/netbackup/bin/

b. Create a file named bpstart_notify.Lab3_coldbackup.


CLIENT # touch bpstart_notify.Lab3_coldbackup
This file will be a script that performs a shutdown of the target database before
NetBackup starts the backup operation.

c. Edit the file to include the following lines:


su - oracle -c sqlplus /nolog <<EOF
connect / as sysdba;
shutdown immediate
exit
EOF
exit 0
IMPORTANT: It is critical that the filenames of the bpstart_notify and bpend_notify
scripts that you create include the exact name of the NetBackup policy used to perform the
backup of the Oracle database, in order for the scripts to be called during the database backup
operation. The names are case-sensitive, therefore bpstart_notify.lab3_coldbackup is
not the same as bpstart_notify.Lab3_coldbackup.

3. Create the NetBackup shell script to startup the database after performing the backup.
a. In the same directory, create a file named bpend_notify.Lab3_coldbackup
CLIENT # touch bpend_notify.Lab3_coldbackup

Copyright 2011 Symantec Corporation. All rights reserved.

This file will be a script that restarts the target database after NetBackup finishes
the backup operation.

340

b. Edit the file to include the following lines:


su - oracle -c sqlplus /nolog <<EOF
connect / as sysdba;
startup
exit
EOF
exit 0

4. Make all notify scripts executable.


CLIENT # chmod 755 bp*_notify.*

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-18

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

5. Test the new bpstart_notify script and ensure that it performs a database shutdown :
CLIENT # sh v bpstart_notify.Lab3_coldbackup

6. Test the new bpend_notify script and ensure that it performs a database startup before
you continue the lab:
CLIENT # sh v bpend_notify.Lab3_coldbackup

7. Prepare to monitor the ORCL alert log to verify that the database does shutdown properly
when a backup is initiated. This can be done as follows:
CLIENT # cd /u02/oradata/admin/ORCL/bdump
CLIENT # tail -f alert_ORCL.log

8. On the MASTER, initiate a manual backup of the database.


a. Start the NetBackup System Administration Console GUI.
MASTER # /usr/openv/netbackup/bin/jnbSA &

b. In the left pane of the NetBackup Administration Console on the master, select
NetBackup Management > Policies.

c. In the All Policies pane of the NetBackup Administration Console, right-click the
Lab3_coldbackup policy and select Manual Backup.

d. In the Manual Backup dialog box, select the Full_Backup schedule, and click OK.
9. Monitor the output from the tail command on the CLIENT to be sure the notify scripts shut
down and start up the database appropriately. In addition, monitor the backup using Activity
Monitor on the MASTER until it completes successfully with a status code of 0 (zero).

10. Type ctrl-c to exit the tail command on the CLIENT, train2.

Lab Summary
This lab exercise provided the steps necessary to use NetBackup to perform a cold consistent
backup of an Oracle database and to then restore that database.

Copyright 2011 Symantec Corporation. All rights reserved.

In this exercise you:

341

Used NetBackup to back up and restore a database


Created and executed bpstart_notify and bpend_notify scripts, which shut down
and restarted the Oracle database

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-19

Copyright 2011 Symantec Corporation. All rights reserved.

342

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-20

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab 4: RMAN Concepts and Backup Operations


The purpose of this lab is to familiarize yourself with the RMAN functions covered in Oracle
Recovery Manager Concepts. In this lab, you:

Establish the RMAN recovery catalog for a target database.


Create an Oracle user account for that database.
Register the target database with RMAN.
Perform RMAN backups to disk

Note: For the purposes of this lab exercise, the target database is ORCL, and the RMAN recovery
catalog database is RMANCAT.

Exercise 1: Creating the RMAN Recovery Catalog


To use RMAN for backup and recovery operations, you must first configure a recovery catalog
database (RMANCAT) to track changes made to the target database (ORCL).
Perform the following steps on the MASTER machine.

1. Create a database user, named rmanowner, to own the recovery catalog.


a. Switch to the Oracle user and verify that the ORACLE_SID is set to RMANCAT.
MASTER # su oracle
MASTER $ env
...
ORACLE_BASE=/u02/oradata
ORACLE_HOME=/u01/oracle
ORACLE_SID=RMANCAT
...
Note: You can also verify this using the set command as oracle.

Copyright 2011 Symantec Corporation. All rights reserved.

b. As the oracle user, open the recovery catalog database (RMANCAT) and perform

343

the following steps to create the rmanowner:


MASTER $ sqlplus /nolog
SQL> connect / as sysdba
SQL> create user rmanowner identified by rmanowner (Enter)
2 temporary tablespace temp (Enter)
3 default tablespace users (Enter)
4 quota unlimited on users; (Enter)
User created.
SQL> grant connect, resource, (Enter)
2 recovery_catalog_owner to rmanowner; (Enter)
Grant succeeded.
SQL> exit

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-21

2. Create the recovery catalog schema.


a. Invoke RMAN.
MASTER $ rman
Recovery Manager: Release 10.2.0.1.0 - Production on Thu
Sep 29 14:40:17 2011
Copyright (c) 1982, 2005, Oracle.

All rights reserved.

b. Connect to the user ID created earlier.


RMAN> connect catalog rmanowner/rmanowner
connected to recovery catalog database

c. Create the recovery catalog schema, then exit RMAN.


RMAN> create catalog;
recovery catalog created
RMAN> exit

3. As the oracle user, you would normally configure the Oracle listener to define the HOST as
the master server.

a. The listener.ora file (found in ${ORACLE_HOME}/network/admin) has


already been configured.
It is not necessary to edit the listener.ora for class labs.
View the listener.ora file.
MASTER $ more $ORACLE_HOME/network/admin/listener.ora

Copyright 2011 Symantec Corporation. All rights reserved.

# listener.ora Network Configuration File:


/u01/oracle/network/admin/listener.ora
# Generated by Oracle configuration tools.

344

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = train1)(PORT = 1521))
)
)

b. As the oracle user, start the listener process on the master system.
MASTER $ lsnrctl start listener
The last line of output from this command should read:
The command completed successfully.
Note: The listener may already be running.

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-22

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 2: Setting User Privileges

Perform the following steps on the CLIENT machine.

1. Verify the values set in the /oracle/network/admin/tnsnames.ora file.


View the tnsnames.ora file for the appropriate master and client host names.
CLIENT $ more $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/oracle/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
RMANCAT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = train1.example.com)(PORT
= 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RMANCAT)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = train2.example.com)
(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)...

2. Verify that the Oracle user sys can now communicate to the recovery catalog:
a. Ping the recovery catalog.

Copyright 2011 Symantec Corporation. All rights reserved.

CLIENT $ tnsping RMANCAT

345

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production


on 28-APR-2011 12:40:12
Copyright 1997, 2005 Oracle. All rights reserved.
Used parameter files:
/u01/oracle/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_= (PROTOCOL =
TCP)(HOST = train1.example.com)(PORT = 1521)) (CONNECT_DATA
= (SERVER = DEDICATED)(SERVICE_NAME = RMANCAT)))
OK (0 msec)

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-23

b. If the command executes successfully, continue to the next step. If the command
fails, troubleshoot as follows:
Double-check the parameters in the listener.ora file on the master.

Double-check the parameters in the tnsnames.ora file on the client.

Ensure the listener is running on the master.

c. As a last check, connect the user rmanowner to RMANCAT by typing the following
command:
CLIENT $ sqlplus rmanowner/rmanowner@RMANCAT
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Sep 29
18:48:10 2011
Copyright (c) 1982, 2005, Oracle.

All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 64bit Production
With the Partitioning, OLAP and Data Mining options

3. In a different terminal window as the oracle user on the CLIENT, verify the
remote_login_passwordfile = EXCLUSIVE setting in the configuration file,
/u01/oracle/dbs/spfileORCL.ora. If the entry does not exist, notify your
instructor.
CLIENT $ more $ORACLE_HOME/dbs/spfileORCL.ora
...
*.background_dump_dest=/u02/oradata/admin/ORCL/bdump
...
*.remote_login_passwordfile = EXCLUSIVE
*.sga_target=167772168
...

4. On the CLIENT machine, create an Oracle user account, named rmandba, with sys
privileges to connect RMAN to the target database.
SQL> create user rmandba identified by rmandba;
User created.

Copyright 2011 Symantec Corporation. All rights reserved.

SQL> grant sysdba to rmandba;

346

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition
Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-24

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 3: Registering the Target Database with RMAN


The final step is to register ORCL with RMAN so that you can use all RMAN backup and restore
functions on the target database.

1. Verify that ORACLE_SID=ORCL.


CLIENT $ echo $ORACLE_SID
ORCL

2. Using RMAN, connect to the RMANCAT database and ORCL database.


CLIENT $ rman target rmandba/rmandba catalog
rmanowner/rmanowner@RMANCAT
Recovery Manager: Release 10.2.0.1.0 Production on Thu Apr
28 13:40:42 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1270287627)
connected to recovery catalog database

3. Register the current database.


RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> exit
Recovery Manager complete.

Exercise 4: Initial Setup for Backups


Perform RMAN backups to the directory /export/data1 on the client.

Copyright 2011 Symantec Corporation. All rights reserved.

Note: If the systems in your classroom have not been setup, your instructor can help you
configure them according to the description provided.

347

As root on the CLIENT, create the directory /export/data1 and an ORCL_backups


subdirectory within the /export/data1 directory. Ensure that the user oracle has write
permissions for this directory.
CLIENT
CLIENT
CLIENT
CLIENT

#
#
#
#

mkdir
mkdir
mkdir
chmod

/export
/export/data1;cd /export/data1
ORCL_backups
777 ORCL_backups

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-25

Exercise 5: Backing Up a Data File to Disk


This exercise describes how to back up a single data file to disk without using the
recovery catalog.
1. As oracle on the client, invoke RMAN without a recovery catalog.
CLIENT # su - oracle
CLIENT $ rman nocatalog
Recovery Manager: Release 10.2.0.1.0 Production on Thu Apr
28 14:17:44 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.

2. Connect to the target database, shut it down immediately, and restart it in mount mode.
RMAN> connect target rmandba/rmandba
connected to target database: ORCL (DBID=1270287627)
using target database control file instead of recovery catalog
RMAN> shutdown immediate
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted ...
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers

1224736768
2020384
318770144
889192448
14753792

bytes
bytes
bytes
bytes
bytes

3. List the data files in the database.

Copyright 2011 Symantec Corporation. All rights reserved.

RMAN> report schema;

348

Report of database schema


File Size(MB) Tablespace RB segs Datafile Name
---- -------- ---------- ------- -----------------1
470 SYSTEM *** u02/oradata/oradate/ORCL/system01.dbf
2
25
UNDOTBS1 *** /u02/oradata/oradata/ORCL/undotbs01.dbf
3
230 SYSAUX *** /u02/oradata/oradate/ORCL/sysaux01.dbf
4
5
USERS
*** /u02/oradata/oradata/ORCL/users01.dbf
List of Temporary Files
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- ---------- ------- -----------------1
20 TEMP 32767 /u02/oradata/oradata/ORCL/temp01.dbf

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-26

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

4. Type the following command to back up the data file, df1.


RMAN> copy datafile 1 to /export/data1/ORCL_backups/df1.bak';

Copyright 2011 Symantec Corporation. All rights reserved.

Starting backup at 30-SEP-11


using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001
name=/u02/oradata/oradata/ORCL/system01.dbf
output filename=/export/data1/ORCL_backups/df1.bak
tag=TAG20110930T072516 recid=2 stamp=763197962
channel ORA_DISK_1: datafile copy complete, elapsed time:
00:00:47
Finished backup at 30-SEP-11

349

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-27

Exercise 6: Backing Up a Tablespace to Disk


This exercise describes how to back up a tablespace to disk without using the recovery catalog.

1. Type the following run commands to back up the system tablespace.


Note : The use of a run block and the allocate channel statements used here are not
necessary in Oracle 10g, but are still functional for backwards compatability.
RMAN> run {
2> allocate channel stream1 type disk format
'/export/data1/ORCL_backups/tblespaces.bak_%U';
3> backup tablespace system;
4> }

Copyright 2011 Symantec Corporation. All rights reserved.

allocated channel: stream1


channel stream1: sid=155 devtype=DISK

350

Starting backup at 30-SEP-11


using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001
name=/u02/oradata/oradata/ORCL/system01.dbf
channel ORA_DISK_1: starting piece 1 at 30-SEP-11
channel ORA_DISK_1: finished piece 1 at 30-SEP-11
piece
handle=/u02/oradata/flash_recovery_area/ORCL/backupset/2011_09
_30/o1_mf_nnndf_TAG20110930T073441_78cfv30m_.bkp
tag=TAG20110930T073441 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:57
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 30-SEP-11
channel ORA_DISK_1: finished piece 1 at 30-SEP-11
piece
handle=/u02/oradata/flash_recovery_area/ORCL/backupset/2011_09
_30/o1_mf_ncsnf_TAG20110930T073441_78cfx1fz_.bkp
tag=TAG20110930T073441 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:18
Finished backup at 30-SEP-11
How long did the backup take?___________________________________

2. Exit RMAN.
RMAN> exit

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-28

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 7: Backing Up the Entire Database to Disk


This exercise describes how to back up an entire Oracle database to disk using the
recovery catalog.
1. As oracle on the CLIENT, invoke RMAN.
CLIENT $ rman

2. Connect to the target database, connect to the recovery catalog, shut the database down
immediately, and restart it in mount mode.
RMAN> connect target rmandba/rmandba
connected to target database: ORCL (DBID=1289542671, not open)
RMAN> connect catalog rmanowner/rmanowner@RMANCAT
connected to recovery catalog database
RMAN> shutdown immediate
Database dismounted
Oracle instance shut down
RMAN> startup mount
Connected to target database (not started)
Oracle instance started
Database mounted
Total System Global Area 1224736768 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers

2020384 bytes
318770144 bytes
889192448 bytes
14753792 bytes

3. Type the following command to back up the target database.

Copyright 2011 Symantec Corporation. All rights reserved.

RMAN> backup database format='/export/data1/ORCL_backups/%U';

351

Starting backup at 30-SEP-11


allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001
name=/u02/oradata/oradata/ORCL/system01.dbf
input datafile fno=00003
name=/u02/oradata/oradata/ORCL/sysaux01.dbf
input datafile fno=00005
name=/u02/oradata/oradata/ORCL/example01.dbf
input datafile fno=00002
name=/u02/oradata/oradata/ORCL/undotbs01.dbf
input datafile fno=00004
name=/u02/oradata/oradata/ORCL/users01.dbf
channel ORA_DISK_1:
starting
piece
at 30-SEP-11
CONFIDENTIAL
- NOT
FOR 1DISTRIBUTION
Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-29

channel ORA_DISK_1: finished piece 1 at 30-SEP-11


piece handle=/export/data1/ORCL_backups/05mnr061_1_1
tag=TAG20110930T075441 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:02:30
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 30-SEP-11
channel ORA_DISK_1: finished piece 1 at 30-SEP-11
piece handle=/export/data1/ORCL_backups/06mnr0b0_1_1
tag=TAG20110930T075441 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:10
Finished backup at 30-SEP-11

Copyright 2011 Symantec Corporation. All rights reserved.

How long did the backup take?___________________________________

352

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-30

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 8: Backing Up the Entire Database to Disk Using Parallel Data Streams
This exercise describes how to utilize parallel backup streams to back up an entire Oracle
database to disk using the recovery catalog.

1. Type the run command to allocate three parallel data streams and to back up the target
database.
How much time do you think this backup will take?_____________________
RMAN> run {
2> allocate channel stream1 type disk format
'/export/data1/ORCL_backups/%U';
3> allocate channel stream2 type disk format
'/export/data1/ORCL_backups/%U';
4> allocate channel stream3 type disk format
'/export/data1/ORCL_backups/%U';
5> backup
6> filesperset 2
7> database;
8> }
released channel: ORA_DISK_1
allocated channel: stream1
channel stream1: sid=157 devtype=DISK
allocated channel: stream2
channel stream2: sid=155 devtype=DISK

Copyright 2011 Symantec Corporation. All rights reserved.

allocated channel: stream3


channel stream3: sid=154 devtype=DISK

353

Starting backup at 30-SEP-11


channel stream1: starting full datafile backupset
channel stream1: specifying datafile(s) in backupset
input datafile fno=00001
name=/u02/oradata/oradata/ORCL/system01.dbf
channel stream1: starting piece 1 at 30-SEP-11
channel stream2: starting full datafile backupset
channel stream2: specifying datafile(s) in backupset
input datafile fno=00003
name=/u02/oradata/oradata/ORCL/sysaux01.dbf
input datafile fno=00004
name=/u02/oradata/oradata/ORCL/users01.dbf
channel stream2: starting piece 1 at 30-SEP-11
channel stream3: starting full datafile backupset
channel stream3: specifying datafile(s) in backupset
input datafile fno=00005
name=/u02/oradata/oradata/ORCL/example01.dbf
input datafile fno=00002
name=/u02/oradata/oradata/ORCL/undotbs01.dbf

CONFIDENTIAL - NOT FOR DISTRIBUTION

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

A-31

Copyright 2011 Symantec Corporation. All rights reserved.

354

channel stream3: starting piece 1 at 30-SEP-11


channel stream3: finished piece 1 at 30-SEP-11
piece handle=/export/data1/ORCL_backups/0jmnrn77_1_1
tag=TAG20110930T142749 comment=NONE
channel stream3: backup set complete, elapsed time:
00:00:28
channel stream3: starting full datafile backupset
channel stream3: specifying datafile(s) in backupset
including current control file in backupset
channel stream3: starting piece 1 at 30-SEP-11
channel stream3: finished piece 1 at 30-SEP-11
piece handle=/export/data1/ORCL_backups/0kmnrn83_1_1
tag=TAG20110930T142749 comment=NONE
channel stream3: backup set complete, elapsed time:
00:00:01
channel stream3: starting full datafile backupset
channel stream3: specifying datafile(s) in backupset
including current SPFILE in backupset
channel stream3: starting piece 1 at 30-SEP-11
channel stream1: finished piece 1 at 30-SEP-11
piece handle=/export/data1/ORCL_backups/0hmnrn76_1_1
tag=TAG20110930T142749 comment=NONE
channel stream1: backup set complete, elapsed time:
00:00:47
channel stream2: finished piece 1 at 30-SEP-11
piece handle=/export/data1/ORCL_backups/0imnrn76_1_1
tag=TAG20110930T142749 comment=NONE
channel stream2: backup set complete, elapsed time:
00:00:47
channel stream3: finished piece 1 at 30-SEP-11
piece handle=/export/data1/ORCL_backups/0lmnrn85_1_1
tag=TAG20110930T142749 comment=NONE
channel stream3: backup set complete, elapsed time:
00:00:16
Finished backup at 30-SEP-11
released channel: stream1
released channel: stream2
released channel: stream3
Was your estimate correct? If not, why not?

2. Exit RMAN.
RMAN> exit

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-32

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Recovery Manager Complete.

Lab Summary
This lab exercise guided you through the necessary steps to create an RMAN recovery catalog for
a target database and register the target database with RMAN. You also learned to perform
RMAN backups, ranging from a single datafile to a complete database.
In this exercise you:

Created and identified the owner of the recovery catalog database.


Created a recovery catalog for the target database ORCL.
Established passwords and user privileges for the target database.
Registered the target database with RMAN.
Initiated RMAN without using a recovery catalog for the target database
Used RMAN to back up a data file, a tablespace, and a complete database to disk
Performed backups both with and without the use of the recovery catalog

Questions/Discussion
When you have finished the lab exercise, answer the following questions:

1. What is the benefit (if any) of allocating multiple parallel data streams?

2. What is the benefit of allocating parallel data streams in an enterprise environment in which
databases and data files are distributed across multiple file systems?

Copyright 2011 Symantec Corporation. All rights reserved.

0.

355

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-33

Copyright 2011 Symantec Corporation. All rights reserved.

356

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-34

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab 5: Performing Backups Using NetBackup for Oracle and


RMAN
NetBackup client software includes all binaries for the NetBackup for Oracle (NBUO) agent,
excluding the need for a separate install. The first purpose of this lab is to link NBUO to RMAN
so that NBUO can manage backup, restore, and recovery functions for Oracle databases.
The second purpose of this lab is to familiarize you with performing backups to tape using
NetBackup for Oracle and RMAN:

Modify shell scripts used by NBUO to conduct both cold and hot database backups.
Use the NBUO Backup Wizard to generate templates for backups.
Establish Oracle policies for both cold and hot database backups.
Test the configuration between NBUO and RMAN by conducting both cold and hot database
backups.

Note: For the purposes of this lab exercise, the target database is ORCL.

Exercise 1: Link and Configure NBUO and RMAN


Because RMAN is an integral part of Oracle10g, it must be reconfigured to use a third-party
media manager; specifically, NBUO. The reconfiguration process involves replacing the current
Oracle media manager shared library with a link to the NetBackup shared library.
To relink, perform the following steps on the CLIENT:

1. Switch to the user oracle.


CLIENT # su oracle

2. Shut down the Oracle database.


CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown immediate
SQL> exit

Copyright 2011 Symantec Corporation. All rights reserved.

3. As the user oracle, run the oracle_link script.

357

CLIENT $ /usr/openv/netbackup/bin/oracle_link
Fri Sep 30 08:23:44 CDT 2011
All Oracle instances should be shutdown before running this
script.
Please log into the Unix system as the Oracle owner for
running this script.
Do you want to continue? (y/n) [n] y

LIBOBK_PATH: /usr/openv/netbackup/bin
CONFIDENTIAL
ORACLE_HOME:
/u01/oracle - NOT FOR DISTRIBUTION
Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-35

Oracle version: 10.2.0.1.0


Platform type: x86_64
Linking LIBOBK:
ln -s /usr/openv/netbackup/bin/libobk.so64
/u01/oracle/lib/libobk.so
Done
Please check the trace file located in /tmp/make_trace.1048 to
make sure the linking process was successful

4. Check the update trace file to confirm that the update was successful.
CLIENT $ more /tmp/make_trace.####
Sun May 1 16:06:44 CDT 2011
All Oracle instances should be shutdown before running this
script.
Please log into the Unix system as the Oracle owner for
running this script.
Do you want to continue? (y/n) [n] y
LIBOBK_PATH: /usr/openv/netbackup/bin
ORACLE_HOME: /u01/oracle
Oracle version: 10.2.0.1.0
Platform type: x86_64 ;
Linking LIBOBK:
ln -s /usr/openv/netbackup/bin/libobk.so64
/u01/oracle/libobk.so
Done

5. Restart the Oracle database.


CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup

Copyright 2011 Symantec Corporation. All rights reserved.

ORACLE instance started.

358

Total System Global Area


Fixed Size
Variable Size
Database Buffers
Redo Buffers
Database mounted.
Database opened.
SQL>

167772160 bytes
2019320 bytes
79691784 bytes
83886080 bytes
2174976 bytes

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-36

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 2: Configuring an RMAN Script for Cold Backup Using the Sample Scripts
NetBackup provides sample RMAN scripts which you can copy to an alternate location and
modify for your specific needs.
As the root user, perform the following steps on the CLIENT machine.

1. Prepare the RMAN scripts.


a. Copy the scripts to a new directory.
CLIENT # mkdir /oracle
CLIENT # mkdir /oracle/scripts
CLIENT # chmod 777 /oracle/scripts
CLIENT # mkdir /oracle/scripts/rman
CLIENT # cp
/usr/openv/netbackup/ext/db_ext/oracle/samples/rman/*
/oracle/scripts/rman

b. Change the permissions of the sample scripts to allow the user oracle to run them.
Also, change the owner of the directories to oracle .
CLIENT # cd /oracle/scripts/
CLIENT # chmod 770 *
CLIENT # chown oracle:dba rman

c. Copy the cold_database_backup script, as shown.


CLIENT # cp /oracle/scripts/rman/cold_database_backup.sh
/oracle/scripts/cold_database_backup.sh

d. Change the owner and group on the copied files, if necessary.


CLIENT # cd /oracle/scripts/
CLIENT # chmod 770 *
CLIENT # chown oracle:dba *

Copyright 2011 Symantec Corporation. All rights reserved.

2. Edit the /oracle/scripts/cold_database_backup.sh file, making the


necessary changes to the Oracle variable values, and listed in Table 3.

359

ORACLE_HOME
ORACLE_SID
ORACLE_USER
TARGET_CONNECT_STR
TARGET_INIT_FILE

/u01/oracle
ORCL
oracle
rmandba/rmandba
/u02/oradata/admin/ORCL/pfile/
init.ora.813201116344
Table 3

3. Set up logging for the bphdb and dbclient processes.


a. Change to the NetBackup logs directory.
CLIENT # cd /usr/openv/netbackup/logs

b. Create subdirectories for the bphdb and dbclient processes.


CLIENT # mkdir bphdb dbclient
CLIENT # chmod 777 bphdb dbclient

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-37

Perform the following steps on the MASTER machine.

4. On the NetBackup master server, create an Oracle policy named ORA_COLD. Use the
parameters for the policy as shown in Table 4.
Policy Name:
Attributes:
Policy Type:
Data classification :
Policy Storage:

ORA_COLD
Oracle
Default
Instructor will specify :
tape_stu or disk_stu
Oracle
(if using tape_stu)
Default
Defaults
Default
Yes (checked)
Defaults
Default

Policy Volume Pool:


Take checkpoints every :
Limit jobs/Job priority :
Media Owner :
Active :
Compression/Encryption :
Keyword phrase :
Schedule :
Note : DO NOT DELETE THE EXISTING SCHEDULE ADD A NEW ONE !!!
Name:
Automatic_Full
Type:
Automatic Full Backup
Retention Period:
Start Window:
For Schedule Type
Clients :
Client Name:
Operating System:
Backup Selections:
Backup Selection List:

infinity
Accept Default
Accept the default settings.
train2
Linux,RedHat2.6
/oracle/scripts/cold_database_backup.sh
Table 4

5. Test the cold database backup configuration by performing a manual backup.


a. Highlight the ORA_COLD policy in the All Policies pane of the NetBackup
Administration Console.

Copyright 2011 Symantec Corporation. All rights reserved.

b. Select Actions > Manual Backup.


c. Select OK from the Manual Backup window that is displayed.

360

6. Monitor the backup progress with the Activity Monitor interface.


Notify your instructor if any of the jobs complete with a non-zero status code.

7. When the jobs complete, examine the bphdb and dbclient logs, located on the client
system, train2. Also, examine the cold_database_backup.sh.out file, located in
the /oracle/scripts directory. This file is generated by the NBUO script.

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-38

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 3: Configuring an RMAN Script for Hot Full Backups


1. On the CLIENT, copy and configure the sample RMAN script.
a. Copy the hot_database_backup script as shown.
CLIENT # cp /oracle/scripts/rman/hot_database_backup.sh
/oracle/scripts/hot_database_backup.sh

b. Change the owner and group on the copied files, if necessary.


CLIENT # cd /oracle/scripts/
CLIENT # chmod 770 *
CLIENT # chown oracle:dba *

2. Edit the /oracle/scripts/hot_database_backup.sh file, and change the


ORACLE_HOME, ORACLE_SID, ORACLE_USER, and TARGET_CONNECT_STR
variables, using the variable values provided in Table 3, on a previous page.
Perform the following steps on the MASTER machine.

3. On the NetBackup master server, create a new policy named ORA_HOT_FULL, using the
parameter provided in Table 5.
Policy Name:
Attributes :
Policy Type:
Data classification :
Policy Storage:

Copyright 2011 Symantec Corporation. All rights reserved.

Policy Volume Pool:


Limit jobs/Job priority :
Media Owner :
Active:
Compression/Encryption :
Keyword phrase :

361

ORA_HOT_FULL
Oracle
Default
Your Instructor will specify
tape_stu or disk_stu
Oracle (if using tape_stu)
Defaults
Default
Yes
(checked)
Defaults
Default

Schedules :
Note : DO NOT DELETE THE EXISTING SCHEDULE ADD A NEW ONE !!!
Name:
Automatic_Full
Type:
Automatic Full Backup
Retention Period:
infinity
Start Window:
Accept Default
For Schedule Type
Accept the default settings.
Clients :
Client Name:
train2
Operating System:
Linux,RedHat2.6
Backup Selections :
Backup Selection List:
/oracle/scripts/hot_database_backup.s
h
Table 5

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-39

4. Change the database to ARCHIVELOG mode.


a. As user oracle on the client, shut down the database and start it up again in mount mode.
CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup mount

b. As user oracle on the client, use sql commands to enable ARCHIVELOG mode and open
the database.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.

5. Verify the database is now in archivelog mode.


SQL> archive log list;
Database log mode
Automatic archival
Archive destination
Oldest online log sequence
Next log sequence to archive
Current log sequence

Archive Mode
Enabled
USE_DB_RECOVERY_FILE_DEST
1
3
3

Note: Database log mode should be Archive Mode.


SQL> exit

6. Test the hot database backup configuration by performing a manual backup. This time
initiate the backup as the oracle user from the CLIENT.
a. As user oracle, set user-defined runtime variables:
CLIENT $ NB_ORA_CLIENT=train2;export NB_ORA_CLIENT
CLIENT $ NB_ORA_POLICY=ORA_HOT_FULL;export NB_ORA_POLICY
CLIENT $ NB_ORA_SCHED=Default-Application-Backup;export
NB_ORA_SCHED
CLIENT $ NB_ORA_SERV=train1;export NB_ORA_SERV

b. Execute the modified script from the command line:

Copyright 2011 Symantec Corporation. All rights reserved.

CLIENT $ /oracle/scripts/hot_database_backup.sh

362

Note: If you receive the following error:


/oracle/scripts/hot_database_backup.sh: line xxx:
/usr/bin/sh: No such file or directory, open a new terminal window
on the client, and as the root user enter:
ln s /bin/sh /usr/bin/sh
Re-run the script (/oracle/scripts/hot_database_backup.sh).

7. Monitor the backup progress with the Activity Monitor interface on the MASTER. Notice
that only jobs associated with the Application Backup schedule appear in Activity Monitor.
You may also monitor the progress of the backup by tailing the
hot_database_backup.sh_out file on the CLIENT.

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-40

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 4: Configuring an RMAN script for Hot Differential Backups


1. On the NetBackup MASTER, create a copy of the ORA_HOT_FULL policy named
ORA_HOT_DIFF. Use the paramter definitions found in Table 6 for this policy.
Note: You could also simply add an Automatic Differential schedule to the existing
ORA_HOT_FULL policy, but that would be an option only if you plan to use the same
retention period (and all other Application Backup schedule settings) for both the full and
differential schedules.
Policy Name:
Attributes:
Policy Type:
Data classification :
Policy Storage:

ORA_HOT_DIFF

Policy Volume Pool:


Limit jobs/Job priority :
Active:
Compression/Encryption :
Keyword phrase :
Schedules:
Application Backup Schedule :

Copyright 2011 Symantec Corporation. All rights reserved.

Automatic Schedule:

363

Name:
Type:
Retention Period:
Start Window:
For Schedule Type
Clients:
Client Name:
Operating System:
Backup Selections:
Backup Selection List:

Oracle
Default
Instructor will specify
tape_stu or disk_stu
Oracle (if using tape_stu)
Defaults
Yes
(checked)
Defaults
Default
Change the schedule name from DefaultApplication-Backup to ApplicationBackup-Diff. Make no additional modifications to
this schedule.
Note: Change the existing Automatic_Full
schedule. Use the schedule parameter information
listed when changing the schedule.
Automatic_Diff
Automatic Differential Incr. Backup
infinity
Accept Default
Accept the default settings.
train2
Linux,RedHat2.6
/oracle/scripts/hot_database_backup.sh
Table 6

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-41

2. Test the differential hot database backup by performing a manual backup from the
NetBackup Administration Console (NetBackup Management > Polices), and selecting the
Automatic-Diff (Automatic Differential Incremental) schedule.
Monitor the backup progress with the Activity Monitor interface.
Note the Application Backup schedule selected for the backup. It may not be the
Application Backup schedule associated with the policy you initiated. This problem can
be avoided by setting user-defined variables and running the NBUO script from the
command line on the client or by copying and modifying the sample script to use the
send command to pass the appropriate schedule name. You would then change the
specified script name in the Backup Selections of the Differential Policy.

3. Perform the backup again, this time initiate the backup as the oracle user from the
CLIENT.

a. As user oracle set user-defined runtime variables:


CLIENT $ NB_ORA_CLIENT=train2;export NB_ORA_CLIENT
CLIENT $ NB_ORA_INCR=1;export NB_ORA_INCR
CLIENT $ NB_ORA_POLICY=ORA_HOT_DIFF;export NB_ORA_POLICY
CLIENT $ NB_ORA_SCHED=Application-Backup-Diff;export
NB_ORA_SCHED
CLIENT $ NB_ORA_SERV=train1;export NB_ORA_SERV

b. Execute the modified script from the command line:


CLIENT $ /oracle/scripts/hot_database_backup.sh

4. Monitor the backup progress from activity monitor. Note that this time theres no possibility

Copyright 2011 Symantec Corporation. All rights reserved.

of NetBackup selecting the wrong application backup schedule since you used an
environment variable to specify. Examine the .out file created by the
hot_database_backup.sh script to ensure a differential backup was performed.

364

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-42

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 5: Creating a NetBackup for Oracle (NBUO) Template for Cold Backup
Perform the following steps on the CLIENT machine.

1. Launch the NBUO Backup Wizard.


a. Launch the NetBackup Client Administration interface.
CLIENT # /usr/openv/netbackup/bin/jbpSA &

b.
c.
d.
e.

Host name

train2

Login

oracle

Password

veritas

Click the Backup Files tab.


Expand the Oracle node in the left pane and select the ORCL instance.
Click the Backup button at the bottom of the screen.
Click Next on the Welcome screen, to continue to the next screen.
The NetBackup for Oracle Backup wizard is displayed.

2. Specify the target database logon credentials.


a. Enter the following values:
Oracle Authentication

OS Authentication

Use Oracle RMAN recovery catalog

Not checked

b. Select Next to continue.


3. Specify the archived redo log options.
a. Enter the following values:
Include archived redo logs in backup

Checked

All redo logs

Selected

Delete archived redo logs after they are backed up

Unchecked

b. Select Next to continue.

Copyright 2011 Symantec Corporation. All rights reserved.

4. Accept the Default configuration, and select Next to continue.

365

5. Add the Backup set identifier, Lab5, and click Next to continue.

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-43

6. Choose the database state - to stop and start the database.


a. Enter the following values:
Take the database OFFLINE BEFORE
the backup starts.

Checked

Bring the database ONLINE AFTER


the backup completes.

Checked

Oracle database initialization parameter


file

/u02/oradata/admin/ORCL/pfile/
init.ora.813201116344

b. Select Next to continue.


7. Enter ORA_COLD_TPL in the Backup policy name field of the NetBackup Configuration
Variables screen, and click Next to continue.

8. Click Next on the Backup Limits screen without entering any values.
9. Review and save the template.
a. Review the template settings.
b. Check Save Template.
c. Enter the Template name, cold_database_backup_template.
d. Click Finish.
10. Verify the template exists on the MASTER machine.
MASTER # cd /usr/openv/netbackup/db/dbtemplates/oracle
MASTER # ls
cold_database_backup_template.tpl

Perform the following steps on the MASTER machine:

11. Create a copy of the ORA_COLD policy named ORA_COLD_TPL.


12. Modify the Backup Selections or the ORA_COLD_TPL policy, to delete the entry for the
script, cold_database_backup.sh, and to add an entry for the template name,
cold_database_backup_template.tpl. Do not type in the full path to the template,
only the template name.

Copyright 2011 Symantec Corporation. All rights reserved.

13. Close the ORA_COLD_TPL policy.

366

14. Invoke a manual backup of the ORA_COLD_TPL policy.


15. Monitor the resulting jobs using the Activity Monitor Interface.

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-44

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 6: Running a User-Initiated Backup of the Template


Run a user-initiated backup of the template from the CLIENT.

a. Select Actions > Administer Templates > Oracle, in the Backup, Archive and
Restore interface.
b. Click to highlight the entry for the cold_database_backup_template in the
Oracle Template Administration dialog box, and click Run.
c. Select OS Authentication in the Run Oracle Template dialog box, and enter the
following options:
Recovery Catalog Logon Credentials
Use Oracle RMAN recovery catalog:

Not Selected

d. Click OK in the Run Oracle Template dialog box, then click Run.
e. Click Yes to view the progress of the backup job, in the Task Progress tab of the
Backup, Archive, and Restore interface.
You can also monitor the job in Activity Monitor on the MASTER machine.

0.
Exercise 7: Changing the Oracle scripts to use the Recovery Catalog
1. On the CLIENT, edit the /oracle/scripts/cold_database_backup script, to use
the RMAN recovery catalog (RMANCAT).
a. Edit the /oracle/scripts/cold_database_backup.sh script.
b. Replace the nocatalog option from the statement which invokes the RMAN
executable with the following :
rcvcat rmanowner/rmanowner@RMANCAT
This statement is required in order to connect to the recovery catalog.

Copyright 2011 Symantec Corporation. All rights reserved.

2. On the MASTER server, invoke another manual backup using the ORA_COLD policy.
Confirm that NetBackup is connecting to the RMAN recovery catalog by examining the
cold_database_backup.sh.out file generated by the NBUO script, located in
/oracle/scripts.

367

3. On the CLIENT, edit the /oracle/scripts/hot_database_backup script, to use


RMAN recovery catalog (RMANCAT).
a. Edit the /oracle/scripts/hot_database_backup.sh script.
b. Replace the nocatalog option from the statement which invokes the RMAN
executable with the following :
rcvcat rmanowner/rmanowner@RMANCAT

4. On the MASTER server, invoke another manual backup using the ORA_HOT_FULL policy.
Confirm that NetBackup is connecting to the RMAN recovery catalog by examining the
hot_database_backup.sh.out file generated by the NBUO script, located in
/oracle/scripts.

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-45

Lab Summary
This lab exercise provided the steps needed to configure NBUO to work with RMAN to perform
both cold and hot database backups.
In this exercise, you:

Linked NBUO with RMAN

Used the NBUO Wizards to automatically generate backup scripts for both hot and cold
backups.

Modified shell scripts used by NBUO to conduct both cold and hot database backups
Established Oracle policies for both cold and hot database backups
Tested the configuration between NBUO and RMAN by conducting both cold and hot
database backups

Questions/Discussion

Copyright 2011 Symantec Corporation. All rights reserved.

Explain the benefits of using the RMAN script to back up the Oracle database.

368

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-46

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab 6: Simple Restore and Recovery Operations with RMAN and


NetBackup for Oracle (NBUO)
The purpose of this lab is to perform basic restore and recovery operations using NBUO and
RMAN following a simulated database failure.

Exercise 1: Configuring an RMAN Script to Restore and Recover a Datafile


1. Verify you that you have a recent backup of the target database before continuing. If
necessary, perform a level 0 (zero) hot database backup using the ORA_HOT_FULL policy
you created in Lab 5. Verify that the backup completes successfully before continuing.
Perform the following steps on the CLIENT machine.

2. As user root, open a separate terminal window and move a data file to a different location.
CLIENT # mkdir /lab6
CLIENT # cd /u02/oradata/oradata/ORCL
CLIENT # mv system01.dbf /lab6

3. As user oracle, shut down the database.


CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown abort

4. Now try to restart the database.


SQL> startup
What happens?

5. As user root, copy the script database_restore.sh into the /oracle/scripts

Copyright 2011 Symantec Corporation. All rights reserved.

directory.

369

CLIENT # cp
/usr/openv/netbackup/ext/db_ext/oracle/samples/rman/database_r
estore.sh /oracle/scripts/
Change the owner and group on the copied files, if necessary.
CLIENT # cd /oracle/scripts/
CLIENT # chmod 770 *
CLIENT # chown oracle:dba *

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-47

6. Edit the /oracle/scripts/database_restore.sh file, making the necessary


changes to the ORACLE_HOME, ORACLE_SID, ORACLE_USER, and
TARGET_CONNECT_STR variable values, as provided in Table 7.
ORACLE_HOME
ORACLE_SID
ORACLE_USER
TARGET_CONNECT_STR

/u01/oracle
ORCL
oracle
rmandba/rmandba
Table 7

In addition, edit the rman command to use the recovery catalog.


Change nocatalog to rcvcat rmanowner/rmanowner@RMANCAT.

7. From the original terminal window (user oracle running SQL*Plus), shut down and
remount the database.
SQL> shutdown abort
SQL> startup mount

8. From the second terminal window, as user oracle run the


/oracle/scripts/database_restore.sh script.
a. Execute the script, typing the full path exactly as specified below:
CLIENT $ /oracle/scripts/database_restore.sh

b. Open an additional terminal window if necessary, and monitor the progress of the
restore using the log file.
CLIENT $ tail -f /oracle/scripts/database_restore.sh.out

9. After the restore is complete, from the second terminal window (user oracle running
SQL*Plus), shut down and restart the database.
SQL> shutdown immediate
SQL> startup
SQL> exit

10. Verify that the database has started and is open.


11. Initiate a manual backup of the database.

Copyright 2011 Symantec Corporation. All rights reserved.

12. Verify that the backup completes successfully before continuing to the next lab exercise.

370

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-48

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 2: Using the NBUO Restore Wizard to Restore and Recover a Datafile
Perform the following steps as user root on the CLIENT machine:

1. Launch the NBUO Backup Wizard.


Launch the NetBackup Client Administration interface.
CLIENT # /usr/openv/netbackup/bin/jbpSA &
Host name

Client Name

Login

oracle

Password

veritas

2. On the Backup, Archive, and Restore interface, specify the NetBackup machines.
a. Click the Restore Files tab.
b. Select Actions > Specify NetBackup Machines and Policy Type from the menu
options at the top of the interface.
c. Select your Oracle client (train2) as the Source client for restores and the
Destination client for restores.
d. Select Oracle as the Policy type for restores.
e. Click OK to return to the Backup, Archive and Restore interface.

3. Expand the Oracle icon displayed in the Directory structure pane.


4. Expand the ORCL database icon in the left pane, and click the Datafiles folder to display
the list of datafiles in the right pane.

5. Click the checkbox to select /u02/oradata/oradata/ORCL/users01.dbf in the


right pane.

6. Click the Restore button.


7. Select Next to continue when the Oracle Recovery Wizard is displayed.

Copyright 2011 Symantec Corporation. All rights reserved.

8. Specify the target database logon credentials.


a. Enter the values, as indicated in Table 8.

371

OSAuthentication
Oracle Authentication
User name :
Password :
Net service name (TNS Alias) :
Use Oracle RMAN recovery catalog

Not selected
Selected
oracle
veritas
Default (leave blank)
Checked
Table 8

b. Click Next to continue.

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-49

9. Enter the Recovery Catalog Logon Credentials (RMANCAT), as shown in the table, and then
click Next to continue.
Username:
Password:
Net service name:

rmanowner
rmanowner
RMANCAT

10. Specify the Recovery Options to define the restore tasks and any associated options.
a. Enter the values as shown in the table.
Restore
Recover

Checked (with no additional options selected)


Checked (with no additional options selected)

b. Click Next to continue.


11. Set the Restore Limits for the restore.
a. Enter the following value:
Use most recent backup set

b. Click Next to continue.


12. Select the Database State parameters.
a. Enter the values, as indicated in the table.
Take the database OFFLINE
BEFORE restore/recover starts
Bring the database ONLINE AFTER
restore/recover completes
Reset logs on database open
Oracle database initialization
parameter file.
Override default priority

Checked
Checked
Not selected
/u02/oradata/admin/ORCL/pfile/
init.ora.813201116344
Not selected

b. Click Next to continue.


13. Review the Selections Summary, and run the template.
a. Review the template settings.
b. Check the Run immediately after finishing wizard check box.
c. Click Finish.

Copyright 2011 Symantec Corporation. All rights reserved.

14. Select Yes in the View Progress dialog box, to monitor restore progress in the Task Progress

372

window. You can also view the restore job using the Activity Monitor on the master server.
Verify that the restore runs successfully.

Lab Summary
This lab exercise provided the practice performing the steps necessary to restore an Oracle
database following a media failure.
In this exercise, you:

Simulated a database failure by moving a critical data file


Enabled RMAN to communicate with the recovery catalog to assist in the database recovery
process

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-50

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab 7: Managing the RMAN Recovery Catalog


The purpose of this lab is to:

Create and execute a stored script.


Become familiar with the commands used to manage the recovery catalog including the
expiring of images from the NetBackup images catalog and the RMAN repository.

Note: For the purposes of this lab exercise, the target database is ORCL and resides on the
CLIENT machine. The recovery catalog database is RMANCAT and resides on the MASTER
machine.

Exercise 1: Storing Scripts in the RMAN Catalog


1. On the CLIENT machine, create a stored RMAN script to perform a full database backup.
a. Launch RMAN and login to the recovery catalog.
CLIENT $ rman target rmandba/rmandba catalog
rmanowner/rmanowner@RMANCAT
Recovery Manager: Release 10.2.0.1.0 - Production on Sat
Oct 1 05:45:42 2011
Copyright (c) 1982, 2005, Oracle.

All rights reserved.

connected to target database: ORCL (DBID=1289542671)


connected to recovery catalog database

b. Create an RMAN script named full_backup.

Copyright 2011 Symantec Corporation. All rights reserved.

RMAN> create script full_backup {


2> ALLOCATE CHANNEL ch00 TYPE sbt;
3> ALLOCATE CHANNEL ch01 TYPE sbt;
4> BACKUP
5> INCREMENTAL LEVEL=0
6> FORMAT 'bk_u%u_s%s_p%p_t%t'
7> DATABASE;
8> RELEASE CHANNEL ch00;
9> RELEASE CHANNEL ch01;
10> }

373

created script full_backup

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-51

c. Confirm the script is correct.


RMAN> print script full_backup;
printing stored script: full_backup
{ALLOCATE CHANNEL ch00 TYPE sbt;
ALLOCATE CHANNEL ch01 TYPE sbt;
BACKUP
INCREMENTAL LEVEL=0
FORMAT 'bk_u%u_s%s_p%p_t%t'
DATABASE;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
}
2. Test the script.
RMAN> RUN {execute script full_backup;}
executing script: full_backup
allocated channel: ch00
channel ch00: sid=148 devtype=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.0
(2010010419)

Copyright 2011 Symantec Corporation. All rights reserved.

allocated channel: ch01


channel ch01: sid=140 devtype=SBT_TAPE
channel ch01: Veritas NetBackup for Oracle - Release 7.0
(2010010419)

374

Starting backup at 01-OCT-11


channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
input datafile fno=00001
name=/u02/oradata/oradata/ORCL/system01.dbf
input datafile fno=00004
name=/u02/oradata/oradata/ORCL/users01.dbf
channel ch00: starting piece 1 at 01-OCT-11
channel ch01: starting incremental level 0 datafile backupset
channel ch01: specifying datafile(s) in backupset
input datafile fno=00003
name=/u02/oradata/oradata/ORCL/sysaux01.dbf
input datafile fno=00005
name=/u02/oradata/oradata/ORCL/example01.dbf
input datafile fno=00002
name=/u02/oradata/oradata/ORCL/undotbs01.dbf
channel ch01: starting piece 1 at 01-OCT-11
channel ch00: finished piece 1 at 01-OCT-11
piece handle=bk_1umo07m2%_s62_p1_t763371202
tag=TAG20111001T073322 comment=API Version 2.0,MMS Version
5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:15
channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
including current control file in backupset
CONFIDENTIAL
- NOT
DISTRIBUTION
channel ch00:
starting piece
1 FOR
at 01-OCT-11
A-52

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

channel ch01: finished piece 1 at 01-OCT-11


piece handle=bk_1vmo07m2%_s63_p1_t763371202
tag=TAG20111001T073322 comment=API Version 2.0,MMS Version
5.0.0.0
channel ch01: backup set complete, elapsed time: 00:02:21
channel ch00: finished piece 1 at 01-OCT-11
piece handle=bk_20mo07od%_s64_p1_t763371277
tag=TAG20111001T073322 comment=API Version 2.0,MMS Version
5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:31
Finished backup at 01-OCT-11
released channel: ch00
released channel: ch01
RMAN>
3. Exit RMAN
RMAN> exit
Recover Manager complete.

Copyright 2011 Symantec Corporation. All rights reserved.

375

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-53

Exercise 2: Managing Retention Policies Using NetBackup


The purpose of this exercise is to demonstrate how to manage retention policies using NetBackup
retention periods.

1. List current backup set information:


CLIENT $ rman target rmandba/rmandba catalog
rmanowner/rmanowner@RMANCAT
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Oct 1
07:43:48 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1289542671)
connected to recovery catalog database
RMAN> list backup;
Note the Backup Set key (BS Key) for the most recent backup (the key with the highest
number).

2. For demonstration purposes only, configure a NetBackup retention period to expire backups
immediately:
a. On the MASTER, launch the NetBackup Administration Console.
MASTER # jnbSA &

b. Select NetBackup Management > Host Properties > Master Servers, and right-click
the entry for the host name of your Master server, in the right pane. Select
Properties.

c. In Master Server Properties dialog box, select Retention Periods in the left pane.
Scroll down the list of Retention periods displayed in the right pane, until you reach
Retention Level 10.

d. Click the entry for Retention Level 10, change the Units setting at the top of the
screen to expires immediately, and click OK to save the retention level change.

Copyright 2011 Symantec Corporation. All rights reserved.

e. Click OK, in the Restart Daemons dialog box.


f. Close the NetBackup Administration Console.
g. Stop the NetBackup daemons on the master server.

376

MASTER # netbackup stop

h. Start the NetBackup daemons on the master server, to activate the new retention
period.
MASTER # netbackup start

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-54

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

3. Change the retention period for backups performed with the ORA_HOT_FULL policy to
expires immediately.
a. Launch the NetBackup Administration Console, and log in as root.
MASTER # jnbSA &

b. Open the ORA_HOT_FULL policy, and change the Retention setting in the DefaultApplication-Backup schedule to the new expires immediately retention period
(Retention Level 10), and click OK to save the change to the schedule.
c. Close the ORA_HOT_FULL policy.

4. Perform a manual backup of ORA_HOT_FULL. Initiate the backup as the oracle user from
the CLIENT machine.
a. As user oracle set user-defined runtime variables:
CLIENT $ NB_ORA_CLIENT=train2;export NB_ORA_CLIENT
CLIENT $ NB_ORA_POLICY=ORA_HOT_FULL;export NB_ORA_POLICY
CLIENT $ NB_ORA_SCHED=Default-Application-Backup;export
NB_ORA_SCHED
CLIENT $ NB_ORA_SERV=train1;export NB_ORA_SERV

b. Execute the oracle script from the command line:


CLIENT $ /oracle/scripts/hot_database_backup.sh

5. Monitor the backup progress on the MASTER server using the Activity Monitor interface,
until the backup jobs complete successfully.

6. Trigger a NetBackup database cleanup job on the MASTER server, to ensure the backup
images are deleted from the NetBackup databases.
Note: This step is only necessary here in the lab environment to ensure the images are
quickly cleaned-up for lab purposes.
MASTER # bpimage cleanup -allclients

7. On the CLIENT system, list current backup set information again now that the backup has
completed successfully, and been expired and deleted from the NetBackup databases:
RMAN> list backup;

Copyright 2011 Symantec Corporation. All rights reserved.

Note the Backup Set Numbers (BS) for the most recent backup.

377

8. Are all the new backup sets listed as AVAILABLE? Why or why not ?

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-55

9. Perform an RMAN CROSSCHECK on the RMAN catalog and check the status of the new
backup sets again:
RMAN> allocate channel for maintenance type sbt;
RMAN> crosscheck backup;
RMAN> list backup;
Is the status of the backup sets still AVAILABLE ? Why or why not ?

10. Delete the expired backup sets from the RMAN catalog and check the status of the new
backup sets one more time :
RMAN> delete expired backupset;
Do you really want to delete the above objects (enter YES or
NO)? y
RMAN> list backup;
Are the backup sets with the expired retentions still listed ?

11. Change the Retention setting in the ORA_HOT_FULL back to an infinite value:
a. On the Master system launch the NetBackup Administration Console.
MASTER # jnbSA &

b. Open the ORA_HOT_FULL policy, change the Retention setting in the Default-

Copyright 2011 Symantec Corporation. All rights reserved.

Application-Backup schedule to infinity and select OK.


c. Close the ORA_HOT_FULL policy.

378

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-56

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 3: Managing Retention Policies with RMAN


1. On the CLIENT system configure an RMAN retention policy using the CONFIGURE
command.
RMAN> configure retention policy to redundancy 2;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
Note: This retention policy will consider more than two backups of the same database object
to be redundant.
2. Check for obsolete backups:
RMAN> report obsolete;
3. Delete obsolete backups:
RMAN> delete obsolete;
Do you really want to delete the above objects (enter YES or
NO)? y
4. Use the report command to see if the backups are still listed:
RMAN> report obsolete;
Are the redundant backups still listed? ______________
5. Exit RMAN.
RMAN> exit
Recover Manager complete.
$

Copyright 2011 Symantec Corporation. All rights reserved.

Lab Summary

379

This lab demonstrated how to manage the RMAN Recovery Catalog.


Specifically, you were able to:

Create and execute a stored script.


Use commands to manage the recovery catalog including the expiring of images from the
NetBackup images catalog and the RMAN repository

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-57

Copyright 2011 Symantec Corporation. All rights reserved.

380

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-58

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Lab 8: Advanced Recovery Operations


This lab demonstrates complex Oracle recovery procedures.
Note: For the purposes of this lab exercise, the target database is ORCL.

Exercise 1: Guided Recovery using OpsCenter


A new feature of NetBackup version 7.x is Guided Application Recovery (GAR) using the
OpsCenter web-based interface. GAR allows you to perform a restore of the database back to the
original disk location or a redirected restore to a different disk location by creating a clone of the
database. Our first exercise for this chapter is to perform a restore of the ORCL database using
OpsCenter and Guided Application Recovery.
Activate metadata collection for Guided Recovery and perform a manual backup of the database.
1. As user root on the Oracle client (train2), add the metadata collection entry to the
bottom of the bp.conf file:
CLIENT # echo ORACLE_METADATA=YES >> /usr/openv/netbackup/bp.conf
2. On the MASTER, perform a manual backup of the ORA_HOT_FULL policy and monitor it
using Activity monitor. Check for jobs associated with metadata collection and notify your
instructor if you dont see them. Allow the backup to complete before you continue.
3. As user oracle on the CLIENT, shut down the database.
SQL> shutdown immediate
4. As user root on the CLIENT, prepare for the restore.
a. CLIENT # cd /u01/oracle/dbs
b. CLIENT # mv spfileORCL.ora spfileORCL.ora.bak
c. CLIENT # mv init.ora init.ora.bak
d. CLIENT # mkdir /disk1/new_loc
e. CLIENT # chown oracle:dba /disk1/new_loc

Copyright 2011 Symantec Corporation. All rights reserved.

5. As user root on the MASTER, check the OpsCenter services.

381

MASTER # /opt/SYMCOpsCenterServer/bin/opsadmin.sh monitor


Note : if the services are down, start them with opsadmin.sh start

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-59

6. Log in to the OpsCenter interface.


a. Launch Firefox.
MASTER # firefox
b. Enter the following URL and credentials:
URL
Login
Password

https://train1/opscenter/
admin
password

7. In the OpsCenter interface, navigate to Manage > Oracle Cloning.


8. Specify train1 as the Master server, and click Go to continue.
9. Select ORCL as the source database that you want to clone, and click Next to continue.
10. Select the most recent control file backup displayed and click Next to continue.
11. Select the CLIENT (train2) as the destination host for the Clone and specify oracle as
the Username.
12. Click Next to continue.
13. Configure the Define destination parameters options.
a. Use the defaults for the Database attributes tab:
Attribute Name

Source Attribute

Destination Attribute

Host name :

train2

train2

Instance Name :

ORCL

ORCL

Database Name:

ORCL

ORCL

Database Home:

/u01/oracle

/u01/oracle

Copyright 2011 Symantec Corporation. All rights reserved.

b. Select the Control File paths tab, and enter the following values :

382

Source Path

Destination Path

/u02/oradata/oradata/ORCL/control
01.ctl

/disk1/new_loc/control01.ctl

/u02/oradata/oradata/ORCL/control
02.ctl

/disk1/new_loc/control02.ctl

/u02/oradata/oradata/ORCL/control
03.ctl

/disk1/new_loc/control03.ctl

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-60

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

c. Select the Datafile Paths tab, and enter the following values :
Tablespace
EXAMPLE
SYSAUX
SYSTEM
UNDOTBS1
USERS
TEMP

Source Datafile Path


/u02/oradata/oradata/
ORCL/example01.dbf
/u02/oradata/oradata/
ORCL/sysaux01.dbf
/u02/oradata/oradata/
ORCL/system01.dbf
/u02/oradata/oradata/
ORCL/undotbs01.dbf
/u02/oradata/oradata/
ORCL/users01.dbf
/u02/oradata/oradata/
ORCL/temp01.dbf

Destination Datafile Path


/disk1/new_loc/example01.dbf
/disk1/new_loc/sysaux01.dbf
/disk1/new_loc/system01.dbf
/disk1/new_loc/undotbs01.dbf
/disk1/new_loc/users01.dbf
/disk1/new_loc/temp01.dbf

d. Select the Redo log paths tab and enter the following values:
Group# Source Path
/u02/oradata/oradata/
3
ORCL/redo03.log
/u02/oradata/oradata/ORCL/
2
redo02.log
/u02/oradata/oradata/ORCL/
1
redo01.log

Destination Path
/disk1/new_loc/redo03.log
/disk1/new_loc/redo02.log
/disk1/new_loc/redo01.log

e. Click Next to continue.


14. Review your selections, and click Next to continue.
15. Select the option to perform a Pre-Clone check. Verify that the pre-check is successful
before continuing.
16. If the pre-check is successful, click Launch Cloning Process.
17. Click OK, in the Lauch Cloning Status dialog box, to go to the Monitor > Jobs interface of
OpsCenter. You can also monitor the restore/clone process using the NetBackup
Administration Console, if you prefer.

Copyright 2011 Symantec Corporation. All rights reserved.

18. Wait until the restore jobs are successful, and then go to the next step.

383

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-61

19. Cloning creates a new database which must be registered with RMAN.
Using RMAN, connect to the RMANCAT database and ORCL database.
CLIENT $ rman target rmandba/rmandba catalog
rmanowner/rmanowner@RMANCAT
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Oct 1
10:23:21 2011
Copyright (c) 1982, 2005, Oracle.

All rights reserved.

connected to target database: ORCL (DBID=1291167386)


connected to recovery catalog database
20. Register the new database.
RMAN> register database;

Copyright 2011 Symantec Corporation. All rights reserved.

database registered in recovery catalog


starting full resync of recovery catalog
full resync complete

384

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-62

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 2: Backing Up the Archived Log Files


Read and complete the entire lab setup procedure before continuing further.
This lab requires a full backup of the database as well as additional archived redo log backups.
These allow the database to be restored and the archived redo logs to be applied.
1. Perform a manual backup of the ORA_HOT_FULL policy. Verify that the backup completes
successfully. Do not continue until you have a full and recent backup of the target database.
2. On the CLIENT system, create a new user, orauser2, in the database.
CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
SQL> create user orauser2 identified by orauser2 default
tablespace users;
User created.
3. Verify that orauser2 exists.
SQL> select * from all_users;

Copyright 2011 Symantec Corporation. All rights reserved.

4. In another terminal window, as the oracle user, run the following RMAN commands and
script to back up the databases archived log files. Ensure that the current log file is switched
to disk.
CLIENT $ rman
RMAN> connect catalog 'rmanowner/rmanowner@RMANCAT'
RMAN> connect target 'rmandba/rmandba'
RMAN> run {
2> allocate channel stream1 type sbt;
3> send 'NB_ORA_POLICY=ORA_COLD';
4> sql 'alter system archive log current';
5> # backup all archive logs
6> backup format 'al_%s_%p_%t' archivelog all
7> delete input;
8> }

385

allocated channel: stream1


channel stream1: sid=143 devtype=SBT_TAPE
channel stream1: Veritas NetBackup for Oracle - Release 7.0
(2010010419)
sent command to channel: stream1
sql statement: alter system archive log current
Starting backup at 01-OCT-11
current log archived
channel stream1: starting archive log backupset
channel stream1: specifying archive log(s) in backup set
input archive log thread=1 sequence=3 recid=3 stamp=763383977
input archive log thread=1 sequence=4 recid=4 stamp=763383979

CONFIDENTIAL - NOT FOR DISTRIBUTION

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

A-63

channel stream1: starting piece 1 at 01-OCT-11


channel stream1: finished piece 1 at 01-OCT-11
piece handle=al_82_1_763383980 tag=TAG20111001T110620
comment=API Version 2.0,MMS Version 5.0.0.0
channel stream1: backup set complete, elapsed time: 00:00:46
channel stream1: deleting archive log(s)
archive log filename=/u01/oracle/dbs/arch1_3_763381290.dbf
recid=3 stamp=763383977
archive log filename=/u01/oracle/dbs/arch1_4_763381290.dbf
recid=4 stamp=763383979
Finished backup at 01-OCT-11
released channel: stream1
RMAN>
When the backup completes, read the RMAN output on the screen and note the thread and
sequence numbers of the last log archived. See the example output above for assistance.
Log Thread #:
Sequence # :
5. In the first terminal window on the CLIENT (used in steps 1, 2, and 3 of this exercise), create
another new user, orauser3, and verify that the user exists.

Copyright 2011 Symantec Corporation. All rights reserved.

6. Now, imagine a scenario in which a user error occured which accidently deleted all customer
records along with associated customer order records. This error occured at the same time
that orauser3 was created. To fix the problem we need to roll back the database to a
point-in-time prior to the user error (and therefore, just prior to the creation of orauser3).

386

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-64

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.

Exercise 3: Recovering the Database


We are simulating a situation in which all customer records and their associated order records
have been destroyed. This hypothetical error occurred at the same time that orauser3 was
created. In the steps that follow, you perform a database recovery to a point-in-time prior to the
creation of orauser3 to resolve the problem.
1. If the database is still running on the CLIENT, shut it down.
SQL> shutdown abort
2. Start up the database in mount mode.
SQL> startup mount
3. Exit any existing RMAN sessions.
4. Use the following RMAN script to restore the database. You will need the thread number
and sequence number noted in a previous step:
CLIENT $> rman
RMAN> connect catalog rmanowner/rmanowner@RMANCAT
RMAN> connect target rmandba/rmandba
RMAN> run {
2> allocate channel stream1 type sbt;
3> restore database until sequence seq# thread thread#;
4> recover database until sequence seq# thread thread#;
5> alter database open resetlogs ;
6> }
Note : When entering the sequence number and thread number in the previous step, notice that
these are entered in the reverse order from which they are listed in the output of the backup job,
as recorded in the Exercise 2 of this lab.
5. Check the database when the restore completes. Perform the following steps on the client:
CLIENT $ sqlplus /nolog
SQL> connect / as sysdba
SQL> select * from all_users;

Copyright 2011 Symantec Corporation. All rights reserved.

a. Does the user orauser2 exist?

387

b. Does the user orauser3 exist?

CONFIDENTIAL - NOT FOR DISTRIBUTION


Symantec NetBackup 7.x for Oracle for UNIX
Copyright Symantec Corporation. All rights reserved.

A-65

Lab Summary
This lab demonstrated complex Oracle recovery procedures. Specifically, it illustrated the steps
required to perform a Guided Recovery using the OpsCenter interface and an incomplete database
recovery using the Until clause.
In this exercise you:
Used Guided Application Recovery to perform a cloning operation of the ORCL database
Backed up archived log files
Simulated a user error that resulted in the complete loss of customer and order records.
Restored and recovered the database to a point-in-time prior to the user error.
Reset the databases online redo logs and the RMAN database.

Copyright 2011 Symantec Corporation. All rights reserved.

388

CONFIDENTIAL - NOT FOR DISTRIBUTION


A-66

Symantec NetBackup 7.x for Oracle for UNIX


Copyright Symantec Corporation. All rights reserved.