Documente Academic
Documente Profesional
Documente Cultură
Recovery Manager
Student Guide
y
l
n
O
e
I
A
&
l
a
n
I
e
D13929GC10
Production 1.0
June 2002
D34786
l
c
a
r
O
n
r
te
s
U
Author
Jim Womack
Technical Contributors
and Reviewers
Agustin Amador
Darren Price
Donna Keesling
Harald van Breederode
Jaime Figueroa
Janet Stern
Lex De Haan
Matthew Arrocha
Matthew Hart
Muthu Olagappan
Petter Stene
Ravinder Ransi
Ric Van Dyke
Sharmila Kulasekaram
Vicki Obrien
Publisher
The information in this document is subject to change without notice. If you find any
problems in the documentation, please report them in writing to Education Products,
Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores, CA 94065.
Oracle Corporation does not warrant that this document is error-free.
Glenn Austin
Oracle and all references to Oracle Products are trademarks or registered trademarks
of Oracle Corporation.
All other products or company names are used for identification purposes only, and
may be trademarks of their respective owners.
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
Contents
I
A
Configuring RMAN
Objectives 2-2
RMAN Configuration Decisions 2-3
Issues to Consider 2-4
Using RMAN Without a Recovery Catalog 2-5
Steps to Create the Recovery Catalog 2-6
Creating an RMAN User 2-7
Creating the Repository 2-8
Recovery Catalog Strategy 2-9
RMAN Backup Strategy Guidelines 2-10
Ways to Start RMAN 2-11
Oracle Real Application Clusters 2-12
Connecting to an Auxiliary Database 2-13
RMAN and Pipes 2-14
Registering a Database in a Recovery Catalog 2-15
&
l
a
n
r
te
n
I
e
r
O
l
c
a
iii
s
U
O
e
y
l
n
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
iv
s
U
O
e
y
l
n
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
s
U
O
e
Summary 4-42
Practice Overview: Restore and Recovery with RMAN 4-43
5
RMAN Maintenance
Objectives 5-2
Oracle9i Command Unification 5-3
CROSSCHECK Command 5-4
The LIST Command 5-5
LIST Command Output 5-7
The REPORT Command 5-8
Report Objects Needing Backup 5-9
Report Unrecoverable Backups and Copies 5-11
Report Obsolete Backups and Copies 5-12
Report Database Schema 5-14
Show RMAN Configuration Settings 5-15
The CHANGEUNAVAILABLE and CHANGEAVAILABLE Commands 5-16
CHANGEUNCATALOG Command 5-17
Deleting Specified Backups and Copies 5-18
Deleting Expired or Obsolete Backups 5-20
Stored Script Information 5-21
Maintenance Required When Not Using a Recovery Catalog 5-22
Summary 5-23
Practice Overview: RMAN Maintenance 5-24
&
l
a
n
r
te
n
I
e
r
O
l
c
a
vi
O
e
y
l
n
I
A
s
U
Debugging RMAN
Objectives 7-2
RMAN Message Output 7-3
The DEBUG Option 7-4
RMAN Code Layer Error Numbers 7-5
Media Manager Error Numbers 7-6
Interpreting RMAN Error Stacks 7-7
Interpreting RMAN Errors 7-8
Interpreting Server Errors 7-9
The sbttest Utility 7-10
Checking Backup and Restore Progress 7-11
Monitoring the Media Manager 7-13
Monitoring Recovery Manager Sessions 7-14
Determining Which Data Files Require Recovery 7-16
Insufficient Privileges 7-17
UNIX Tape Backup Failure 7-19
NT Tape Backup Failure 7-21
RMAN Session Is Hung in Media Manager 7-22
RPC Call Fails 7-24
Snapshot Control File Creation Failure 7-25
RMAN Cannot Locate an Archived Log 7-27
Missing Log Causes Duplication Failure 7-29
Summary 7-30
Practice Overview: Debugging RMAN 7-31
RMAN Performance Tuning
Objectives 8-2
Tuning RMAN 8-3
RMAN Disk Buffer Allocation 8-4
Disk Buffer Allocation Example 8-5
Tape Buffer Allocation 8-6
Synchronous Versus Asynchronous I/O 8-7
Synchronous Versus Asynchronous I/O 8-8
Setting LARGE_POOL_SIZE 8-9
Performance Monitoring 8-10
Asynchronous I/O Bottlenecks 8-11
Synchronous I/O Bottlenecks 8-12
Tape Backup Speed 8-13
Tape Subsystem Performance Rules 8-14
Empty Files and Incremental Backups 8-15
Control Tape Buffer Size with BLKSIZE 8-17
&
l
a
n
r
te
n
I
e
r
O
l
c
a
vii
I
A
y
l
n
s
U
O
e
y
l
n
O
e
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
viii
s
U
Preface
Profile
Before You Begin This Course
Before you begin this course, you should have the following qualifications:
Prerequisites
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Preface-1
Related Publications
Oracle Publications
Title
Part Number
A87860
Additional Publications
read.me files
Oracle Magazine
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Preface-2
Typographic Conventions
Typographic Conventions in Text
Convention
Bold italic
Element
Glossary term (if
there is a glossary)
Example
The algorithm inserts the new key.
Caps and
lowercase
Buttons,
check boxes,
triggers,
windows
Courier new,
case sensitive
(default is
lowercase)
Code output,
directory names,
filenames,
passwords,
pathnames,
URLs,
user input,
usernames
Initial cap
Graphics labels
(unless the term is a
proper noun)
Emphasized words
and phrases,
titles of books and
courses,
variables
Interface elements
with long names
that have only
initial caps;
lesson and chapter
titles in crossreferences
Italic
Quotation
marks
Uppercase
r
O
Convention
Arrow
I
A
&
l
a
n
r
te
n
I
e
l
c
a
O
e
y
l
n
s
U
SQL column
names, commands,
functions, schemas,
table names
Element
Menu paths
Example
Select File > Save.
Copyright Oracle Corporation, 2002. All rights reserved.
Preface-3
Brackets
Key names
Press [Enter].
Commas
Key sequences
Plus signs
Key combinations
Lowercase
italic
Uppercase
Element
Oracle Forms
triggers
Column names,
table names
Example
When-Validate-Item
Passwords
PL/SQL objects
Syntax variables
SELECT userid
FROM emp;
SELECT last_name
FROM s_emp;
y
l
n
O
e
s
U
This course uses simplified navigation paths, such as the following example, to
direct you through Oracle Applications.
I
A
(N) Invoice > Entry > Invoice Batches Summary (M) Query > Find (B) Approve
This simplified path translates to the following:
&
l
a
1.
(N) From the Navigator window, select Invoice > Entry > Invoice Batches
Summary.
2.
3.
n
r
te
n
I
e
l
c
a
Notations :
r
O
(N) = Navigator
(M) = Menu
(T) = Tab
Copyright Oracle Corporation, 2002. All rights reserved.
Preface-4
(I) = Icon
(H) = Hyperlink
(B) = Button
Typographical Conventions in Help System Paths
This course uses a navigation path convention to represent actions you perform
to find pertinent information in the Oracle Applications Help System.
The following help navigation path, for example
(Help) General Ledger > Journals > Enter Journals
represents the following sequence of actions:
1.
In the navigation frame of the help system window, expand the General
Ledger entry.
2.
3.
4.
Review the Enter Journals topic that appears in the document frame of the
help system window.
y
l
n
O
e
Getting Help
s
U
Whenever you need assistance, simply choose an item from the Help menu to
pinpoint the type of information you want.
To display help for a current window:
I
A
&
l
a
1.
Choose Window Help from the Help menu, click the Help button on the
toolbar, or hold down the Control key and type 'h'.
n
r
te
l
c
a
r
O
2.
n
I
e
If the document frame contains a list of topics associated with the window,
click on a topic of interest to display more detailed information.
Preface-5
3.
You can navigate to other topics of interest in the help system, or choose
Close from your web browser's File menu to close help.
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Preface-6
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Understand the fundamentals of the Recovery
Manager (RMAN) architecture and its components
Understand the features, components, and tasks
of RMAN
Understand the basic concepts of consistency
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Recovery Manager
O
e
y
l
n
s
U
Recovery Manager
RMAN is a tool that manages the process of creating backups and the process of restoring and
recovering from these backups. The product is a feature of the Oracle database server and does
not require separate installation. RMAN is a client/server application that uses database server
sessions to perform backup and recovery. It stores metadata about its operations in the control
file of the target database and, optionally, in a recovery catalog schema in an Oracle database.
You can invoke RMAN as a command line executable from the operating system prompt or use
some RMAN features through the Enterprise Manager GUI.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
RMAN Features
The features of RMAN include:
Automation of backup, restore, and recovery
Easy backup of archived redo logs
Automatic detection and inclusion of new data
files
Support of incremental backups
Better performance during recovery
No generation of extra redo during open database
backups
O
e
y
l
n
s
U
RMAN Features
RMAN automates backup and recovery, whereas the user-managed method requires you to keep
track of all database files and backups. For example, instead of requiring you to locate backups
for each data file, copy them to the correct place using operating system commands, and choose
which logs to apply, RMAN manages these tasks automatically.
RMAN especially simplifies the backup and restore process when using Oracle Managed Files.
When you use Oracle Managed Files, Oracle names and manages your data files, control files,
and online redo logs. This simplifies your management of these files. However it may be harder
for you to keep track of the filenames of the various database files because you have not named
them yourself. By using RMAN, it handles all record keeping. For example, the addition of a
data file will automatically be detected, and included within the next backup.
RMAN can perform incremental backups, which back up only those data blocks that changed
after a previous backup. However, you can only take incremental backups of a NOARCHIVELOG
database after a consistent shutdown. You can restore the database by using incremental
backups, which means that you can restore a NOARCHIVELOG database.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
RMAN Features
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
RMAN Architecture
Server
session
(default)
Enterprise
Manager
Recovery
Manager
Server
session
(Catalog)
Target
Controlfile
Target
Instance
Fixed
tables and
views
sys.dbms_rcvman
sys.dbms_backup_restore
Server
session
(polling)
Disk
Server
session
(channel)
dbms_rcvcat
dbms_rcvman
Catalog
tables and
views
Recovery
Catalog
Media Manager
Tertiary
Storage
Server
session
(channel)
Target
Database
Files
O
e
y
l
n
s
U
RMAN Architecture
The RMAN executable can run on any machine, with Oracle9i Net Services connections being
made to the databases. The Recovery Catalog is a simple database schema residing in a database
separate from the target. Relevant information is obtained from the control file if a catalog is not
used. Using the Recovery Catalog is optional.
The target database is the database from which backup, restoration, or recovery is taking place.
The RMAN connection to it is always of the SYSDBA type. In the target instance and database
the following is used:
Two sessions for administrative purposes. These will make use of several packages in the
database, which are installed when catproc.sql runs.
One session for every allocated channel. Channels transfer the actual database data.
The control file is also stores schema, backup and recovery information. The control file
and the recovery catalog information are synchronized with RMAN.
The Media Management Library (MML) is software that connects to a particular vendors
tape backup system. This is linked into the Oracle executable at installation.
Backup disks must reside on the same machine as the target database. If you are working with a
tape system, it may reside anywhere. The MML software component ensures connectivity
between RMAN and the tape subsystem. Using Oracle Enterprise Manager to control RMAN is
optional.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
RMAN Components
The RMAN tool consists of the following components:
Recovery Manager executable (RMAN)
RMAN library file: recover.bsq
Recovery Catalog
Tables
Views
RMAN Packages
DBMS_RCVMAN
DBMS_RCVCAT
DBMS_BACKUP_RESTORE
y
l
n
O
e
s
U
I
A
Recovery Catalog
The recovery catalog is a repository storing information relating to the target database obtained
from the target database control file. It contains information about the physical schema of the
target database, data file, archivelog backup sets and pieces, data file copies, archived redo logs,
and stored scripts. If the recovery catalog is not used, RMAN queries the target databases
control file to decide what actions to perform.
&
l
a
n
r
te
n
I
e
RMAN Packages
The DBMS_RCVMAN and DBMS_RCVCAT packages are used respectively by RMAN to query
and update the recovery catalog. DBMS_BACKUP_RESTORE is the RPC interface to the code
that physically performs the backup, restore, and recovery actions
l
c
a
r
O
RMAN Components
Target Database
Control file fixed tables and views
Channel (Server Sessions)
Media management interface module
Media Manager Server
y
l
n
O
e
s
U
Target Database
The database on which the specified backup, restore, and recover actions will be executed.
I
A
&
l
a
Channel
For each channel, RMAN creates an Oracle Server process on the target database to perform the
backup, restore, or recovery.
n
r
te
n
I
e
l
c
a
r
O
Recovery Manager
Utility Executable
The RMAN executable is responsible for:
Parsing Recovery Manager command syntax
Performing name translations relative to any time
specifications such as point-in-time recovery or
user specified tags
Generating PL/SQL programs which make remote
procedure code (RPC) calls to the above packages
Coordinating execution of PL/SQL calls on
channels allocated
Updating the recovery catalog
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
To start the executable, simply enter the filename on the command line. For example, on a UNIX
system, enter:
$ rman
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Recovery Catalog
O
e
y
l
n
s
U
Recovery Catalog
The recovery catalog is a set of tables, views, indexes, and PL/SQL packages, which are created
in a schema, known as the recovery catalog owner. The recovery catalog consist of several
components, which include:
Base tables and indexes: These tables and indexes should not need to be queried.
RC_* views: RC_* views can be queried. These views will be covered in more detail in a
later lesson.
DBMS_RCVMAN package: RMAN queries the recovery catalog tables via the procedures in
this package. RMAN never selects data directly from the recovery catalog tables, it uses the
views.
DBMS_RCVCAT package: RMAN updates the recovery catalog tables via the procedures
in this package. RMAN never updates the recovery catalog tables directly.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Target Database:
Controlfile Tables and Views
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Target Database:
SYS.DBMS_RCVMAN
The SYS.DBMS_RCVMAN functions read data from the
control file fixed views.
This is an alternate implementation of the
DBMS_RCVMAN package.
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Target Database:
DBMS_BACKUP_RESTORE
O
e
SYSDBMS_BACKUP_RESTORE
y
l
n
s
U
SYS.DBMS_BACKUP_RESTORE is the RPC interface to the code that physically performs the
backup, restore, and recovery actions that are requested by RMAN.
Because it is linked into the Oracle executable, DBMS_BACKUP_RESTORE is callable whenever
an instance is started. The database does not need to be mounted or open.
Note: Whenever Oracle documentation indicates to run a restore operation under circumstances
such as with no recovery catalog or no control file, it indicates contacting support. What is meant
by this is that support will indicate which DBMS_BACKUP_RESTORE calls to make to recover a
control file and RMAN can automate the restore from that point.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Target Database:
DBMS_BACKUP_RESTORE
SQL>
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
y
l
n
s
U
Channels
An RMAN channel represents one stream of data to a device type and corresponds to one server
session. Allocation of one or more RMAN channels is necessary to execute most backup and
recovery commands. Each channel establishes a connection from the RMAN executable to a
target or auxiliary database instance by starting a server session on the instance. The server
session performs the backup, restore, and recovery operations. Only one RMAN session
communicates with the allocated server sessions. New with Oracle9i is automatic channel
allocation which relieves the user from the step of explicitly allocating a channel in a
backup/restore or maintenance session.
Oracle has integrated proxy copy functionality into its media management API. Vendors can use
this API to develop media management software that takes control of backup and restore
operations. RMAN provides a list of files requiring backup or restore to the media manager,
which in turn makes all decisions regarding how and when to move the data.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
run {
allocate channel c1 type disk;
copy datafile 10 to
'/oracle/prod/backup/prod_10.dbf';
}
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
Note that you do not need to run ALLOCATE CHANNEL if you already did so within the
script or if you have automatic channels configured.
The CREATE SCRIPT command is used to create a stored script and is covered in detail in a
later lesson.
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Database Inconsistency
Constraint inconsistency
Logical inconsistency
Structural inconsistency
Physical inconsistency
At the block level
At the inter-block level
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
Redo Generation
Redo is generated whenever any data block changes for whatever reason. Recall that the data file
header is a special data block, and that the control file, too, is read and written in blocks (but not
cached data blocks like the data files).
As a transaction generates redo it also generates undo, which in turn generates more redo. In
practice, this is done backward: the server code first generates all the redo, then the undo, and
lastly the data change. The amount of redo generated can be controlled by the use of the
NOLOGGING clause. You can see the amount of redo generated in V$SYSSTAT in the row
redo size.
I
A
&
l
a
n
r
te
n
I
e
Undo Generation
Undo cannot be suppressed. It is the same mechanism regardless of whether you use automatic
undo management or manually managed rollback segments.You can see the amount of undo
generated in V$ROLLSTAT under the column WRITES, and V$TRANSACTION under the
columns USED_UBLK and USED_UREC.
r
O
l
c
a
Recovery Concepts
No generation of redo
O
e
y
l
n
s
U
Recovery Concepts
For all redo vectors:
The block (DBA) specified in the vector is read into the cache.
If the block has the same time as the redo record (SCN and SEQ fields match), then the
redo vector is applied.
The block is written out by a recovery checkpoint at a log switch or when aged out of
cache.
The method that determines whether or not a block needs recovery allows for the normal
situation that blocks inside the data file were written between the full checkpoints. The start of
redo is determined by the file header and is a safe starting point. The recovery decision process
also allows for recovery being reapplied repeatedly, or restarted after a crash while applying
redo. Only if the redo and block match in time will the redo be applied. Note that the word
time refers to the logical time line as given by the SCN and SEQ and not to any timestamp.
This also makes the recovery process safe against changes of the clock, such as daylight savings
time. There is no redo generated while performing recovery. The control file is also modified,
tracking the progress of the recovery.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Stuck Recovery
y
l
n
O
e
s
U
Stuck Recovery
Stuck recovery should cause a trace or a dump, typically ORA-600[3020]. To progress past a
stuck recovery, the block must be marked corrupt because there is no consistent information
about what the block content should be.
In Oracle9i this is performed with either ALLOW 1 CORRUPTIONS, or with TEST in the
recover command.
The hidden parameter _CORRUPT_BLOCKS_ON_STUCK_RECOVERY was needed to
accomplish this Before Oracle9i,
I
A
&
l
a
n
r
te
Test Recovery
Oracle9i introduced test or trial recovery. Test recovery is a dry run of a media recovery,
reading and modifying data blocks, but not writing the changes back to disk. During normal
recovery, if there is any serious error the recovery will stop. After correcting the error, recovery
is attempted again, only to fail at the next error. Test recovery is used to see how many such
serious errors might occur. Depending on the answer, a different recovery scenario might be
attempted. Test recovery can also mark blocks as corrupt. Data cannot be retrieved from such
blocks, but can be skipped.
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
When a user attempts to retrieve data from such a table or index they receive:
ORA-26040: Data block was loaded using the NOLOGGING option
n
I
e
l
c
a
Blocks belonging to sort segments, temporary tables and any block in a temporary tablespace
will not generate any redo. As these blocks contain data that only has a lifetime of a statement or
session, then the data is not needed if there is a crash which either aborts the statement or the
session.
r
O
Summary
In this lesson, you should have learned how to:
Understand the fundamentals of the RMAN
architecture and its components
Understand basic backup structures
Identify the features, components, and tasks of
RMAN
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
Configuring RMAN
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Understand RMAN configuration decisions
Outline the steps taken in creating a recovery
catalog
Create/grant privileges to a RMAN user
Start RMAN and register a database in a recovery
catalog
Demonstrate the use of recovery catalog
maintenance commands such as RESYNC,
CONFIGURE, and CATALOG
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Issues to Consider
Some issues to ponder when deciding whether or not
to use a Recovery Catalog:
If the control file is lost and a need to restore and
recover the database (Oracle8i) arises, the
customer will require the assistance of Oracle
Worldwide Customer Support Services
Point-in-time recovery (PITR) can be difficult or
impossible
The overhead of a recovery catalog
O
e
y
l
n
s
U
Issues to Consider
RMAN can be configured to use a recovery catalog in addition to the target databases control
file. Some implications of not using a recovery catalog include:
Losing a control file with a need to restore and recover. If the database is pre Oracle9i,
Support can only help if the user maintains excellent records (that is, RMAN message log
files) of which files were backed up, the date the backup occurred, and the names of the
backup pieces.
Point-in-time recovery may be more difficult if the database schema has changed since the
point that you want to recover until, especially if there are data files that existed then but do
not exist now. Such a recovery cannot be automated with RMAN. You must first restore a
backup control file that knows about the physical schema that existed at the recovery time.
If the database uses a large number of data files (more than 1000), then backup and restore
performance is better with a recovery catalog. If not using a recovery catalog, multiple backups
of the control file should be kept on different disks, tapes, and/or machines. These backups must
be restorable without RMAN.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
Starting RMAN
There are many ways that a user can start RMAN depending on how RMAN was configured and
of course the users current needs. In addition to the methods demonstrated above, RMAN can
additionally be started in the following ways:
By connecting to a target instance (either locally or remotely) when using a password file
and specifying a TNS alias in the target connect string while using a recovery catalog:
$ rman target_db internal/secret@prod rcvcat rman/rman@rcat
By connecting to a target database (either locally or remotely) when using a password file
and specifying a TNS alias in the target connect string, no recovery catalog:
$ rman target scott/tiger@prod nocatalog
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
Each net service name must specify one and only one instance. You cannot specify a net service
name that uses Oracle Net features to distribute connections to more than one instance.
Although RMAN connects to only one instance for its initial target connection, note that this
does not preclude running a backup against all three instances. For example, you can configure
automatic channels to connect to each instance then make a whole database backup by running
the BACKUP DATABASE command.
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Registering a Database
in a Recovery Catalog
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Non-circular reuse
Resync requires a read-consistent image of the
control file, thus a need for snapshot.
y
l
n
O
e
s
U
Circular Reuse
This record type is suited for information that is continuously generated by the server and can be
overwritten if need be, because it is not critical for production operation. Records are arranged in
a logical ring. When all available slots are full, the control file is either expanded to make room
for the new record or the oldest record is overwritten. The parameter that determines which of
these two options will be used is CONTROLFILE_RECORD_KEEP_TIME. Examples include
log history, archived log, backup record, offline ranges.
I
A
&
l
a
n
r
te
Noncircular Reuse
For information that is not changed often and because be overwritten, because it is critical for
production operation. Examples include data files, redo threads, online redo logs.
n
I
e
r
O
l
c
a
Full resync
Used when some noncircular reuse records need to
be resynced
The RESYNC CATALOG command always does a full
resync
y
l
n
O
e
s
U
Partial Resync
Partial resyncs are used when only circular reuse records need to be resynced and as such does
not require a read-consistent image of the control file. Partial resyncs are only done during an
RMAN automatic resync, and when RMAN detects that a full resync is not needed.
I
A
Full Resync
Because full resyncs are used when some noncircular reuse records need to be resynced, a readconsistent image of the control file is needed. A full resync reads from the snapshot control file,
not from the current control file. Whenever the RESYNC CATALOG command is issued, a full
resync is always performed. An RMAN automatic resync will only be a full resync when a
noncircular reuse record has changed to avoid creating the snapshot control file if not necessary.
RMAN automatically detects when it needs to perform a full or partial resynchronization and
executes the operation as needed. You can also force a full resynchronization by issuing a
RESYNC CATALOG command.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
I
A
y
l
n
s
U
The recovery catalog should be resynced regularly, because it is not automatically updated when
a redo log is archived; instead this information is cached in the control file, and should be
periodically propagated to the recovery catalog. To ensure that the catalog stays current, run the
RESYNC CATALOG command periodically. A good rule of thumb is to run it at least once per
each 10 archived logs. The cost of this operation is related to the number of new or changed
records in the control file since the previous resync. So, the more often you resync, the quicker
the operation will complete.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
When RMAN needs to resynchronize from a readconsistent version of the control file, it creates a
temporary snapshot control file.
RMAN needs a snapshot control file only when
resynchronizing with the recovery catalog or when
making a backup of the current control file.
Created the same way as ALTER DATABASE
BACKUP CONTROLFILE.
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Persistent RMAN
Configuration Parameters
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Retention Policies
y
l
n
O
e
s
U
Retention Policies
A retention policy describes which backups will be kept and for how long. The value of the
retention policy is set by the new CONFIGURE command. The best practice is to establish a
period of time during which it will be possible to discover logical errors and fix the affected
objects by doing a point-in-time recovery to just before the error occurred. This period of time is
called the recovery window. This policy is specified in number of days. For each data file, there
must always exist one backup which satisfies the condition SYSDATE-CHECKPOINT_TIME
<= recovery_window
For example if the policy were set as follows:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
CONFIGURE RETENTION
POLICY Command
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
RMAN cannot implement an automatic retention policy if backups are deleted using non-RMAN
methods. One such method is the media managers tape retention policy. Ideally, the media
manager will never expire a tape until all RMAN backups residing on that tape have been
removed from the media managers repository.
There is a difference between CONFIGURE RETENTION POLICY TO NONE and
CONFIGURE RETENTION POLICY TO DEFAULT. The first means that there is no
retention policy: backups will never expire, and DELETE OBSOLETE will give an error. The
second means that the default retention policy (REDUNDANCY 1) will be in effect.
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
Automatic channel allocation also applies to maintenance commands. If you manually allocate a
maintenance channel by using ALLOCATE CHANNEL FOR MAINTENANCE, then RMAN
uses the following convention for channel naming: ORA_MAINT_devicetype_n.
n
I
e
For example, RMAN uses these names for two manually allocated disk channels:
ORA_MAINT_DISK_1 and ORA_MAINT_DISK_2
l
c
a
RMAN knows the command that is being run. For backups, only a single type of channel is
allocated. For restores, RMAN knows which device types are required, allocating all necessary
channels.
r
O
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
In general, you should only need to set the control file location in these situations:
In an Oracle Real Application Clusters configuration and need a snapshot control file
accessible by each node
You are upgrading from a pre-8.1.7 release. In pre-8.1.7 releases, the default location for
the snapshot control file was not dependent on the Oracle home
If you are performing TSPITR or using the DUPLICATE command, setting AUXNAME allows
you to preconfigure the filenames for use on the auxiliary database without manually specifying
the auxiliary filenames during the procedure.
r
O
l
c
a
y
l
n
O
e
s
U
I
A
The CONFIGURE EXCLUDE command excludes tablespaces from whole database backups.
This is useful in preventing repeated backups of read-only or offline tablespaces. Note that the
system tablespace may not be excluded.
RMAN> CONFIGURE EXCLUDE FOR TABLESPACE SAMPLE;
The CONFIGURE command allows the user to adjust the level of parallelism for backup, restore
and maintenance operations. For tape (SBT) the degree of parallelism should be set to the
number of physical tape drives. Otherwise, degradation will occur. For example:
RMAN> CONFIGURE DEVICE TYPE SBT PARALLELISM 2;
The CONFIGURE DEFAULT DEVICE command specifies which device type is used for
automated backups. Valid values for device_type_spec are: DISK or SBT The default
value is DISK.
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO SBT;
Many elements of RMAN scripts are repetitive and are usually identical in every script. It is
possible to enter and store a persistent configuration that describes such repetitive elements, such
as the number and type of channels that will be used or the degree of parallelism.
Also, it is no longer necessary to use the RUN{} syntax for most scripts.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
CATALOG Command
O
e
CATALOG Command
I
A
y
l
n
s
U
The control file keeps records of all archived logs generated by the target database. If you use a
recovery catalog, then RMAN propagates the archived log information from the control file to
the catalog. If you have to restore a control file backup, and if you change the archiving
destination or format during recovery, then the repository will not have information about
archived logs needed for recovery. Hence, you must catalog these logs if you want to use them
for recovery.
When you make user-managed copies, the repository has no record of them. You must manually
notify RMAN when you make copies with an operating system utility such as the UNIX cp
command. Run the RMAN CATALOG command when:
Adding information about a user-managed data file copy, archived redo log copy, or
control file copy to the recovery catalog and control file
Cataloging a data file copy as a level 0 backup, thus enabling you to perform an
incremental backup later by using the data file copy as the base of an incremental backup
strategy
Recording the existence of user-managed copies of Oracle release 8.0 and later databases
created before RMAN was used
Recording the existence of Oracle7 backups before migrating to Oracle 8.0 or later
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Catalog of Consistent
and Inconsistent Copies
For a user-managed copy to be cataloged, it must be:
Accessible on disk
A complete image copy of a single file
Either a data file copy, control file copy, or
archived redo log copy
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
These rows indicate that the catalog was created with a release 8.1.7 executable, then upgraded
to release 9.0.1, and finally upgraded to release 9.2.0. The current version of the catalog schema
is 9.2.0.
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Summary
In this lesson, you should have learned how to:
Understand RMAN configuration decisions
Outline the steps taken in creating a recovery
catalog
Create/grant privileges to a RMAN user
Start RMAN and register a database in a recovery
catalog
Demonstrate the use of recovery catalog
maintenance commands like RESYNC, CONFIGURE,
and CATALOG
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Practice Overview:
Configuring RMAN
This practice covers the following topics:
Starting RMAN and connecting to a target
database
Creating a recovery catalog
Registering a database
Query relevant views in the repository
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Identify the types of backups supported by RMAN
Define a file copy backup, and identify its contents
Define a backup set, its types, contents, and
purpose
Identify the difference between an incremental and
cumulative incremental backup
Outline the Recovery Manager backup algorithm
Demonstrate a working knowledge of the BACKUP
command functionality
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
RMAN Backups
O
e
y
l
n
s
U
RMAN Backups
Run backups of any of the following objects with the RMAN BACKUP command when the
database is either mounted or open:
Primary or standby database
Tablespace
Data file (current or image copy)
Archived redo log
Control file (current or image copy)
Server parameter file (currently in use only)
Backup set
The BACKUP command backs up database files into one or more backup sets on disk or
tape. You can set parameters for the BACKUP command to specify the filenames for the
backup pieces, the number of files to go in each set, and which channel should operate on
each input file. You can make RMAN backups when the database is open or closed. Closed
backups can be consistent or inconsistent, depending on how the database was shut down.
RMAN backups are further divided into full and incremental backups. Full backups are nonincremental; that is, every used block is backed up.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Interactively:
RMAN> backup database;
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Backup Tags
O
e
y
l
n
s
U
Backup Tags
A character string called a tag may be assigned to backup sets and image copies. A tag is a
case-insensitive name for a backup set or file copy such as weekly_backup. You can
specify the tag rather than the filename when executing the RESTORE or CHANGE
command. The maximum length of a tag is 30 characters.
If you are using Oracle9i Release 2, RMAN will create a tag for backups and copies (if you
do not specify a tag name)) in the format TAGYYYYMMDDTHHMMSS, where YYYY is the
year, MM is the month, DD is the day, HH is the hour (in 24-hour format), MM is the
minutes, and SS is the seconds. The date and time refer to when RMAN started the backup.
For example, a backup of data file 1 may receive the tag TAG20020208T133437. When
applied to a backup set, a tag applies to a specific copy of the backup set. If the backup set is
not duplexed then a one-to-one relationship exists between the tag and the backup set.
Tags do not need to be unique, so multiple backup sets or image copies can have the same
tag name, for example, wkly_bkup. When a tag is not unique, then with respect to a given
data file, the tag refers to the most current suitable file. By default, RMAN selects the most
recent backups to restore unless qualified by a tag or a SET UNTIL command. The most
current suitable backup containing the specified file may not be the most recent backup, as
can occur in point-in-time recovery.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Backup set
A backup set is a logical object containing backups
of one or more data files or archived logs.
A backup set is created by the BACKUP command.
y
l
n
O
e
s
U
File Copies
File copies can be done through RMAN or the host operating system. Operating system
backups on disk can be cataloged in the recovery catalog for immediate use. Once the O/S
backups have been cataloged, they can then be backed up by RMAN to disk or via the
Media Management Layer. The LEVEL 0 option to the CATALOG command allows O/S
backups to be used as a basis for incremental backups. RMAN initiated file copies are like
OS copies in that all blocks of the file are copied whether they contain data or not. Because
of this, all copies are considered to be LEVEL 0.
run {
allocate channel d1 type disk;
copy level 0 datafile 1 to /oracle/prod/backup/file1.dbf;
}
I
A
&
l
a
n
r
te
n
I
e
l
c
a
Backup Sets
A backup set consists of one or more physical output files called backup pieces. Backup sets
usually contain multiple source files that are multiplexed in the output. It can be written to
disk or tertiary storage, which requires media manager support. A restore operation is
required to extract files from a backup set.
r
O
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
Note: The greater the degree of parallelism, the higher the machine resource but the shorter
the duration.
n
I
e
r
O
l
c
a
Backup Set
There are two types of backup sets:
Data file backup sets
Can include the control files
Can be Incremental or Full backups
Do not include empty blocks
y
l
n
O
e
s
U
Backup Sets
You can back up data files, control files, archived redo logs, and the current server
parameter file (Oracle9i only). Archived logs can be backed up also, but they require a
separate set. You can also back up another backup set, as when you want to back up a disk
backup to tape, or an image copy. For example, you can issue commands such as the
following, each of which uses an automatic channel configuration:
RMAN> BACKUP DATABASE;
RMAN> BACKUP TABLESPACE users, tools;
I
A
&
l
a
n
r
te
When backing up data files, the target database must be mounted or open. If the database is
in ARCHIVELOG mode, then the target can be open or closed: you do not need to close the
database cleanly. If the database is in NOARCHIVELOG mode, then you must close it
cleanly before making a backup.
Data file backup sets do not include empty blocks. An empty block is a block that has never
contained data. If a block has been used but is no longer part of an allocated extent, it is still
backed up because the backup process does not have access to space management
information. This is a source of some confusion as some think that RMAN will omit blocks
that do not currently contain data. For example if a table is dropped, RMAN will continue to
back up the blocks even though the extents used by that table are now free.
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Automatic allocation:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
You can change a parallelism setting by issuing another CONFIGURE DEVICE TYPE...
PARALLELISM command.
Backup Pieces
y
l
n
O
e
s
U
Backup Pieces
Each backup set contains at least one backup piece. If you do not restrict the backup piece
size, then every backup set contains only one backup piece. To restrict the size of each
backup piece, specify the MAXPIECESIZE option of the CONFIGURE CHANNEL or
ALLOCATE CHANNEL commands. This option limits backup piece size to the specified
number of bytes. You can either let RMAN determine a unique name for backup pieces or
use the FORMAT parameter to specify a name. If you do not specify a filename, then RMAN
uses the %U substitution variable to generate a unique name.
RMAN automatically generates unique names for the backup pieces. The FORMAT
parameter provides substitution variables that you can use to generate unique filenames. For
example, you can run a command as follows:
BACKUP TABLESPACE users FORMAT = /tmp/users_%u%p%c;
I
A
&
l
a
n
r
te
n
I
e
l
c
a
Format can be specified in three places, and will be used in the following precedence:
BACKUP OBJECT
BACKUP COMMAND
ALLOCATE/CONFIGURE CHANNEL
r
O
Database ID
Piece number
Set stamp, set count
Type of backup
How many directory blocks follow the piece header
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Level 0
Day
Sun
2
Mon
2
Tue
1
Wed
2
Thu
2
Fri
2
Sat
0
Sun
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Level 0
Day
Sun
2
Mon
2C
Tue
1
Wed
2
Thu
2C
Fri
2C
Sat
0
Sun
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
I
A
y
l
n
s
U
The data files checkpoint SCN at the time the backup began. This is the checkpoint that the
file will have after this incremental is applied.
INCREMENTAL_CHANGE#
&
l
a
The checkpoint SCN for the data file as it was in the backup this one is based on. The
INCREMENTAL_CHANGE# is also known as the incremental-start SCN.
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
If all of these conditions are false, then RMAN uses the advanced algorithm. You can
always force RMAN to use the basic algorithm by setting DISKRATIO=0.
n
I
e
r
O
l
c
a
Algorithm Rules
The most important rules in the algorithm for backup
set creation are:
Each allocated channel that performs work in the
backup job generates at least one backup set
containing at least one piece.
RMAN will calculate FILESPERSET parameter of
the BACKUP command if not set.
O
e
y
l
n
s
U
Algorithm Rules
The basic backup algorithm follows several important tenants when creating backup sets.
Each allocated channel that performs work in the backup jobthat is, each channel that is
not idle generates at least one backup set. By default, this backup set contains one backup
piece. RMAN always tries to divide the backup load so that all allocated channels have
roughly the same amount of work to do.
The basic algorithm determines the number and size of the backup pieces by balancing the
FILESPERSET and MAXSETSIZE (if used) parameters of the BACKUP command. The
FILESPERSET parameter of the BACKUP command determines the maximum number of
data files in each backup set. If none is specified, RMAN will calculate this figure by
comparing the value 64 to the rounded-up ratio of number of files divided by the number of
channels, and sets FILESPERSET to the lower value. For example, if you are backing up
140 files and allocating 2 channels, RMAN divides 140 by two, compares the resultant 70 to
64 and chooses 64 as the value for FILESPERSET.
The maximum size of a backup set is determined by the MAXSETSIZE parameter of the
CONFIGURE or BACKUP command. When you set this, RMAN uses the algorithm to
determine the number of files to write to each set.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Advanced Algorithm
y
l
n
O
e
s
U
Advanced Algorithm
The advanced algorithm uses the same factors as the basic algorithm to determine the
number and size of backup sets. The difference is that the advanced algorithm is also
influenced by the DISKRATIO parameter. If DISKRATIO = n, then each backup set must
read data from at least n disk drives. RMAN uses file location information obtained from the
database server to determine which data files are on which disk drives.
If you set FILESPERSET but not DISKRATIO, then DISKRATIO defaults to the same
value as FILESPERSET. If you specify neither parameter, then DISKRATIO defaults to 4.
RMAN compares DISKRATIO to the number of devices and uses the lowest value.
I
A
&
l
a
n
r
te
Assume that a database contains 50 data files spread across 6 disks, and the operating system
is able to deliver this disk contention information to the server. You configure a single sbt
channel and then run BACKUP DATABASE.
n
I
e
l
c
a
RMAN will use the advanced algorithm because the basic algorithm indicates that because
you did not specify FILESPERSET or MAXSETSIZE, RMAN should produce a single
backup set. The advanced algorithm also looks at DISKRATIO, which in this case defaults
to 4. Therefore, each backup set must contain data files from at least four disks. Because
RMAN is only producing one backup set containing all data files from all six disks,
DISKRATIO makes no difference.
r
O
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Backup Optimization
O
e
y
l
n
s
U
Backup Optimization
If you enable backup optimization, then the BACKUP command skips the backup of a file
when the identical file has already been backed up to the allocated device type. If RMAN
determines that a file is identical and it has already been backed up, then it is a candidate for
skipping. However, RMAN must do further checking to determine whether to skip the file,
because both the retention policy feature and the backup duplexing feature influence the
algorithm that determines whether RMAN has enough backups on the specified device
type.
With backup optimization, the BACKUP command skips the backup of a file if the identical
file has already been backed up to the allocated device type. To override this behavior and
back up all files whether or not they have changed, specify the FORCE option on the
BACKUP command. To enable or disable backup optimization, specify ON or OFF with the
CONFIGURE BACKUP OPTIMIZATION command.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Backup set
Same backup set record id and stamp
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
RMAN skips backup only if at least n backups of an identical file exist on the specified
device. If RMAN does not skip the backup, then it makes the backup exactly as specified.
l
c
a
Archived Log
By default, n = 1. RMAN searches for values of n in this order of precedence (that is, values
higher on the list override values lower on the list):
BACKUP ... COPIES n
SET BACKUP COPIES n.
r
O
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
In this case, RMAN sets n = 3 and so will not back up the logs created before 9 a.m. because
three copies already exist on tape. However, only two copies of the logs created after 9 a.m.
exist on tape, so RMAN does not optimize backups of these logs. Therefore, RMAN backs
up three copies of the logs created after 9 a.m.
r
O
Duplexed Backups
O
e
y
l
n
s
U
Duplexed Backups
Multiple or duplexed backup copies can be made by using the SET DUPLEX command
when running your backup. Use the SET DUPLEX command before allocating any
channels. The SET DUPLEX command affects all channels allocated after issuing the
command.
Backup duplexing can be used with the DELETE INPUT option to make sure more than
one backup of an archived log exists before the log is deleted from disk.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Duplexed Backups
Backup duplexing provides an efficient way to
produce multiple copies of each backup piece.
Duplexing under Oracle9i using the COPIES
option:
BACKUP DEVICE TYPE DISK COPIES 3 DATAFILE 7
FORMAT /tmp/%U,?/oradata/%U,?/%U;
y
l
n
O
e
s
U
Duplexed Backups
RMAN provides an efficient way to produce multiple copies of each backup piece in a
backup set. This functionality is also known as duplexing a backup set. You can create up
to four identical copies of each piece in a backup set. If multiple commands are in effect
simultaneously, then commands higher on the list override commands that are lower on
the list. Duplexing under Oracle9i is done using the COPIES option while Oracle8i
requires the use of the SET DUPLEX command. Duplexing can be used with the
DELETE INPUT option to make sure more than one backup of an archived log exists
before the log is deleted from disk. Duplexed backups require a FORMAT specification
that guarantees uniqueness.
%c - copy number (1-4)
%U This is the default format; and is equivalent to %u_%p_%c
I
A
&
l
a
n
r
te
n
I
e
l
c
a
In the slide example, observe that RMAN places the first copy of each backup piece in
/tmp, the second in ?/oradata, and the third in the Oracle home. Note that RMAN
does not produce three backup sets, each with a different unique backup set key.
r
O
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Mirrored Backups
y
l
n
O
e
s
U
Mirrored Backups
When making mirrored backups it is possible to specify up to four different locations with
the format option. The second, third, and fourth values are used in conjunction with the SET
BACKUP COPIES command. RMAN will use the first format value for copy 1, the second
format value for copy 2, and so on. If more format values are specified than copies, the extra
format values will be discarded. If there are more copies specified than format values, then
the format values will be reused starting with the first value. The example below illustrates
this concept:
SET BACKUP COPIES 3
BACKUP DATABASE FORMAT '/U01/backups/%U','/U02/backups/%U';
I
A
&
l
a
n
r
te
n
I
e
As a result, the first copy is placed in /u01/backups, the second copy is placed in
/u02/backups, and the third copy is placed in /u01/backups.
r
O
l
c
a
Proxy Copy
y
l
n
O
e
s
U
Proxy Copy
A proxy copy is a special type of backup in which RMAN turns over control of the data
transfer to a media manager that supports this feature. The PROXY option of the BACKUP
command specifies that a backup should be a proxy copy. For each file that you attempt to
back up using the BACKUP PROXY command, RMAN queries the media manager to
determine whether it can perform a proxy copy. If the media manager cannot proxy copy the
file, then RMAN uses conventional backup sets to perform the backup. An exception occurs
when you use the PROXY ONLY option, which causes Oracle to issue an error message when
it cannot proxy copy.
Oracle records each proxy-copied file in the control file. RMAN uses this data to
resynchronize the recovery catalog. Use the V$PROXY_DATAFILE view to obtain the
proxy copy information. Use the CHANGE PROXY command or DELETE PROXY command
to change the status of or delete a proxy backup.
I
A
&
l
a
n
r
te
n
I
e
l
c
a
You can monitor the progress of proxy copies, backups, regular copies, and restores by
querying the view V$SESSION_LONGOPS. RMAN uses two types of rows in
V$SESSION_LONGOPS; detail and aggregate rows. Detail rows describe the files being
processed by one job step, while aggregate rows describe the files processed by all job steps
in an RMAN command.
r
O
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
Now your backups exist on both disk and tape. You can also duplex backups of backup sets
(except for control file autobackups), as in this example:
BACKUP COPIES 2 DEVICE TYPE sbt BACKUPSET ALL;
r
O
l
c
a
Note: If backup optimization is enabled when you issue the command to back up a backup
set and the identical backup set has already been backed up to the same device type, then
RMAN skips the backup of that backup set.
Oracle9i Database: Supporting Recovery Manager 3-34
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
By time:
RMAN> backup archivelog from time 01-jan-00
until time 30-jun-00;
By name:
RMAN> backup archivelog like
oracle/arc/dest/log%;
By archived logs:
RMAN> backup archivelog all;
By log sequence:
RMAN> backup archivelog from logseq 20 until
logseq 50 thread 1;
By SCN:
RMAN> backup archivelog from scn 1 until scn 9999;
y
l
n
O
e
s
U
I
A
&
l
a
Please note that only the archivelog backed up is deleted. This is an issue for multiple
archivelog destinations.
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
For example, you can validate that all database files and archived redo logs can be backed
up by issuing a command as follows:
RMAN> BACKUP VALIDATE DATABASE ARCHIVELOG ALL;
&
l
a
n
r
te
If the backup validation discovers corrupt blocks, then RMAN updates the
V$DATABASE_BLOCK_CORRUPTION view with rows describing the corruptions. After a
corrupt block is repaired, the row identifying this block is deleted from the view.
Another important use of BACKUPVALIDATE is to identify corrupt blocks and populate
the V$DATABASE_BLOCK_CORRUPTION view, then use the data to repair the blocks with
the BLOCKRECOVER command like this:
RMAN> BACKUP VALIDATE DATABASE;
RMAN> BLOCKRECOVER CORRUPTION LIST;
n
I
e
l
c
a
r
O
Note: You cannot use the MAXCORRUPT or PROXY parameters with the VALIDATE option
or validate backups of backup sets.
Oracle9i Database: Supporting Recovery Manager 3-38
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Restarting a Backup
y
l
n
O
e
s
U
Restarting a Backup
Using the restartable backup feature, RMAN can back up only those files that have not been
backed up since a specified date. This feature is intended for cases when a backup fails
partway through and you only want to back up the part of the database that did not finish..
Use the SINCE TIME parameter of the BACKUP command to specify a date after which a
new backup is required. If you do not specify the SINCE parameter, then RMAN only backs
up files that have never been backed up.
To only back up files that were not backed up after a specified date, specify a valid date in
the SINCE TIME parameter. For example, this command uses the default configured
channel to back up all database files and archived redo logs that have not been backed up in
the last two weeks:
RMAN> BACKUP NOT BACKED UP SINCE TIME SYSDATE-14
2> DATABASE PLUS ARCHIVELOG;
I
A
&
l
a
n
r
te
n
I
e
l
c
a
The unit of restartability is a single backup set. If the entire database is backed up into one
backup set, and if a backup fails, then the entire backup has to be rerun. If the backup
generates multiple backup sets, then the backups that completed successfully do not have to
be rerun. For this reason, you can set FILESPERSET to a value much lower than the
default so that RMAN limits the number of files that it places in each backup set.
r
O
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Summary
In this lesson, you should have learned how to:
Identify the types of backups supported by RMAN
Define a file copy backup, and identify its contents
Define a backup set, its types, contents, and
purpose
Identify the difference between an incremental and
cumulative incremental backup
Outline the Recovery Manager backup algorithm
Demonstrate a working knowledge of the BACKUP
command functionality
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Practice Overview:
Backups With Recovery Manager
This practice covers the following topics:
Creating a cold backup
Using the CATALOG command
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Identify tasks performed by RMAN before
restoring
Understand important RESTORE functionality
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
I
A
y
l
n
s
U
When performing a restore, RMAN initially allocates memory structures and buffers it
anticipates will be needed for the operation. The headers of the files to be restored are
read and recovery decisions are made. The backup set relative-file number in the data
block address is then replaced with the tablespace relative-file number. If RMAN is
restoring a data file backup set, unused block ranges are identified and re-created. When
each output buffer is filled, it is sent to the output device. Input buffers and output buffers
do not need to be in sync. Many input buffers can be processed before an output buffer is
filled. The file header is restored last to ensure that a partially restored file cannot be
accidentally used.
RMAN can tell if a file has not been completely restored. It knows how many pieces are
in the set. If all pieces in the set are completely read and the file header is not
encountered, DBMS_BACKUP_RESTORE requests another piece, which RMAN knows
does not exist.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Restore Optimization
O
e
y
l
n
s
U
Restore Optimization
In releases prior to Oracle9i, RMAN always restored the requested files. In Oracle9i, RMAN
only restores a file if the header check does not succeed. This is now the default behavior.
By using the FORCE option of the RESTORE command it is possible to override this
behavior and restore the requested files unconditionally. Understand however, that restore
optimization only checks the data file header and does not the scan the data file body for
corrupted blocks.
Restore optimization is particularly useful in cases where a restore only partially completes.
For example, assume that your system or instance crashed during a full database restore. If
you start the same restore after startup, RMAN will only restore the data files that were not
restored during the previous attempt. With the ever-increasing size of databases today, this
time-saving feature is extremely important.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Restore Concepts
RMAN performs several tasks prior to the restore
process:
Queries the recovery catalog:
To determine the configuration of the database
Identify the backups available for use
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Restore a tablespace:
RMAN> RESTORE TABLESPACE tools;
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
When RMAN performs a restore, the restored files are created as data file copies and
recorded in the repository. If the SWITCH command is run in conjunction with the SET
NEWNAME command, RMAN updates the data file names in the control file to the names of
the restored files; otherwise this update does not take place. When restoring data files or
tablespaces, the database can be up but the data files or tablespaces must be offline:
RMAN> SQL "ALTER TABLESPACE tools OFFLINE IMMEDIATE";
RMAN> RESTORE TABLESPACE tools;
RMAN> RECOVER TABLESPACE tools;
RMAN> SQL "ALTER TABLESPACE tools ONLINE";
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Using a catalog:
RMAN> RESTORE SPFILE;
Without a catalog:
RMAN> RESTORE SPFILE FROM AUTOBACKUP;
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
Next, shutdown the instance and restart without mounting and restore the SPFILE:
RMAN> STARTUP FORCE NOMOUNT
RMAN> RESTORE SPFILE;
r
O
l
c
a
Finally, restart the instance. If the server parameter file was restored to a nondefault
location, the steps are slightly different.
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Parallelization of RESTORE
O
e
Parallelization of RESTORE
y
l
n
s
U
If there are multiple backup sets that need to be read to restore the whole database, it is
faster to allocate an equal number of channels, thereby increasing the degree of
parallelization. However, if there is only one backup set that needs to be read to restore the
whole database, other channels would not be necessary and would not be used at all, even if
allocated.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
Because the restored database will not have the online redo logs of the production database,
perform incomplete recovery up to the lowest SCN of the most recently archived log in each
thread and then open with the RESETLOGS option. Obtain the SCN for recovery
termination by finding the lowest SCN among the most recent archived logs for each thread.
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
To perform the validation, the database can be mounted or open. You do not have to take
data files offline when validating them.
n
I
e
l
c
a
This example validates the restore of the backup control file, SYSTEM tablespace, and all
archived logs:
RMAN> RESTORE CONTROLFILE VALIDATE;
RMAN> RESTORE TABLESPACE SYSTEM VALIDATE;
RMAN> RESTORE ARCHIVELOG ALL VALIDATE;
r
O
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Restore Autolocation
O
e
y
l
n
s
U
Restore Autolocation
In a Real Application Clusters configuration, RMAN automatically restores backups,
control file copies, and data file copies from channels that can read the files on tape or a
local file system. So long as you configured or manually allocated channels that connect
to each node in the cluster, RMAN hunts for files on all channels and restores files only
from those channels that locate the backup or copy on tape or on a local file system.
For example, if channel 1 connected to instance 1 can read log 1000 from its tape drive,
but channel 2 connected to instance 2 cannot read the log from its tape drive, then channel
1 restores the log. Autolocation is automatically enabled when the channels meet any of
the following criteria:
Different PARMS settings
Different connect strings
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
s
U
Support Note
Note: 60545.1 How to Extract Control Files, Data Files, and Archived Logs from SMR
Backupsets describes in great detail the process of manually extracting objects from
RMAN backups.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Recovery Types
Complete recovery
A recovery where all changes made to the database
since the restored backup have been applied
(including changes recorded in the online redo
logs)
Incomplete Recovery
A recovery where the recovery is stopped before all
changes made to the database since this backup
was applied
O
e
y
l
n
s
U
Recovery Types
The concept of data file media recovery is the application of online or archived redo logs
or incremental backups to a restored data file in order to update it to the current time or
some other specified time. Use the RMAN RECOVER command to perform media
recovery and apply logs or incremental backups automatically. For our purposes, recovery
fall under two categories; complete recovery and incomplete recovery. Incomplete
recoveries are performed:
To undo a user error (recover to the point-in-time before the error occurred)
When all redo information to complete the recovery is not available
When the online logs are lost, and are not mirrored
A time to recover to may be specified as a time, log sequence number, or SCN. Time
and log sequence are first resolved to an SCN before recovery is done. All files must be
recovered to the same point-in-time.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Recovery Concepts
O
e
Recovery Concepts
ARCHIVELOG Mode
I
A
y
l
n
s
U
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
RMAN then queries the repository, which in this example is a recovery catalog. The
recovery catalog obtains its metadata from the target database control file. RMAN then
decides which backup sets to restore, and which incremental backups and archived logs to
use for recovery. A server session on the target database instance performs the actual
work of restore and recovery.
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
RCV2 (Phase 2)
Check for any incremental backups and offline ranges that can be applied. Incremental
backups are applied to a level 0 or full backup. If an incremental backup cannot be found,
then the control file view V$ARCHIVED_LOG is searched for the names of archived redo
logs to use for recovery.
r
O
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Parallelization of Recovery
Redo Application
Can be parallelized by setting the INIT.ORA
parameter RECOVERY_PARALLELISM
RMAN will restore archived redo logs automatically
as they are required.
Alternatively, archived logs can be manually
restored to disk in preparation for recovery.
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Trial Recovery
O
e
y
l
n
s
U
Trial Recovery
In the past, some problems that can occur during media recovery were not recoverable.
For media recovery, this means that you must restore the backup and recover the database
again to an SCN before the point where the corruption occurred. For a large database, this
can take a long time. The following enhancements are now provided:
If media recovery of a full database encounters a problem, recovery always leaves
behind a consistent database, a database that can be opened read-only or with
resetlogs.
Database administrators can instruct media recovery to mark a data block as being
corrupted and therefore ignore its inconsistency in order to proceed with recovery.
The block will be inaccessible but the rest of the recovery process will continue.
Using another new option of recovery command, database administrators can invoke
Trial Recovery in order to investigate if a recovery problem is an isolated problem.
With these enhancements, almost all practical problems during media recovery are
recoverable thanks to an optimistic redo application algorithm. Recovery optimistically
assumes that no problem will occur during media recovery. If one does occur, the Oracle
server will rollback the last changes that caused inconsistency in the recovered database.
Note: Trial recovery is a user managed recovery option. For more information on Trial
Recovery, refer to the Oracle9i User-Managed Backup and Recovery Guide.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Recover a NOARCHIVELOG
Database Example
Assume the following scenario:
The database TRGT operates in NOARCHIVELOG
mode.
A recovery catalog is used.
The database is shut down consistently and a
level 0 backup is made to tape on Sunday
afternoon.
The database is shut down consistently and a
level 1 differential incremental backup is made to
tape at 4:00 a.m. on Wednesday and Friday.
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
DBPITR Example
Database Point-In-Time Recovery
$ rman target internal/secret@prod rcvcat
rman/rman@rcat
RMAN> startup nomount
RMAN> run {
2> set until time "to_date('2002/02/23 16:00:00',
3> 'YYYY/MM/DD HH24:MI:SS')";
4> allocate channel t1 type 'SBT_TAPE';
5> allocate channel t2 type 'SBT_TAPE';
6> restore controlfile;
7> sql 'alter database mount';
8> restore database;
9> recover database;
10> }
Copyright Oracle Corporation, 2002. All rights reserved.
O
e
y
l
n
s
U
DBIPTR Example
The above example illustrates the restore of the whole database, including control file (to
the original locations) until time 2002/02/23 16:00:00. This example assumes the
database is stopped. Note the startup command is done from RMAN.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
BLOCKRECOVER Examples
1.
2.
3.
4.
O
e
y
l
n
s
U
BLOCKRECOVER Examples
1. Recovering a group of corrupt blocks
BLOCKRECOVER datafile 2 BLOCK 12, 13 datafile 7 BLOCK 5,
98, 99 datafile 9 BLOCK 19;
2. This example recovers a series of blocks and restores only from data file copies:
RUN {
BLOCKRECOVER data file 3 BLOCK 1,2,3,4,5
TABLESPACE sales DBA 4194405, 4194409, 4194412
FROM data fileCOPY;
}
3. Limiting BMR by backup tag
BLOCKRECOVER TABLESPACE SYSTEM DBA 4194404, 4194405 FROM
TAG "weekly_backup";
4. The following example recovers two blocks in the SYSTEM tablespace and forces
the blocks to be restored from backups created at least two days ago:
BLOCKRECOVER TABLESPACE SYSTEM DBA 4194404, 4194405
RESTORE UNTIL TIME 'SYSDATE-2';
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
Summary
In this lesson, you should have learned how to:
Identify tasks performed by RMAN before
restoring
Understand important RESTORE functionality
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Practice Overview:
Restore and Recovery with RMAN
This practice covers the following topics:
Familiarity with DBMS_BACKUP_RESTORE
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
RMAN Maintenance
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Use the LIST command to display backup data
recorded in the catalog or target control file
Use the REPORT command to gather detailed
information regarding recovery catalog data
Use the CROSSCHECK and DELETE commands
Use the SHOW command to view configuration
details
Use the CHANGE command to alter the status of
object backups
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
CROSSCHECK Command
O
e
I
A
y
l
n
s
U
Sometimes backups and copies disappear from disk, or tapes in the media management
library become unavailable. Crosschecks can also update the repository if you delete
archived redo logs or other files using operating system commands. To ensure that data
about backup sets and image copies in the recovery catalog or control file is synchronized
with actual files on disk or in the media management catalog, perform a crosscheck. For
files on disk, RMAN directly verifies that the file exists. For files on SBT_TAPE, RMAN
queries the media management software. The CROSSCHECK command operates only on
files that are recorded in the RMAN repository.
Use CROSSCHECK to check the status of a backup or copy on disk or tape. If the backup
or copy is on disk, then CROSSCHECK checks whether the header of the file is valid. If a
backup is on tape, then the command checks that the backups exist. Backup sets, pieces,
and copies can be AVAILABLE, EXPIRED, or UNAVAILABLE. You can issue the
DELETE EXPIRED command to delete all expired backups and copies. RMAN removes
the record for the expired file from the repository. If for some reason the file still exists on
the media, then RMAN issues warnings and lists the mismatched objects that cannot be
deleted.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
DB Key
------1
1
Inc Key
------2
73
DB Name
-------U02
U02
&
l
a
DB ID
-----------775813490
775813490
n
r
te
n
I
e
CUR
--NO
YES
Reset SCN
---------1
440227
Reset Time
---------06-MAR-02
27-MAR-02
r
O
l
c
a
y
l
n
Column
Indicates
----------- -------------------------------------------------------------------------------------------File
The absolute data file number
Key
A unique key identifying this backup set. If you are connected to a recovery
catalog, then Key is the primary key of the backup set in the catalog. It
corresponds to BS_KEY in the RC_BACKUP_SET view. If you are connected
in NOCATALOG mode, then Key displays the RECID from
V$BACKUP_SET. RECID and STAMP form a concatenated primary key that
uniquely identifies this record in the target control file.
TY
The type of backup: backup set (B) or proxy copy (P)
LV
The backup level: F for non-incrementals, level 0-4 for incrementals
S
The backup set status: available (A), unavailable (U), or expired (X)
Ckp SCN The checkpoint of the data file at the time it was backed up.All database
changes prior to the SCN have been written to the file; changes after the
specified SCN have not been written to the file
Ckp Time The checkpoint of the data file at the time it was backed up. All changes
prior to the time have been written to the file; changes after the specified time
have not been written to the file
#Pieces The number of backup pieces in the backup set
#Copies The number of copies made of each backup piece in the set. The number
is 1 if no duplexing was performed. Otherwise, the value ranges from 2 to 4
Tag
The tag applied to the backup set; NULL if none
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
l
c
a
r
O
n
r
te
n
I
e
===============
Key
TY LV S
------- -- -- 45
B F A
55
B F A
59
B 1 A
69
B F A
88
B F A
Device Type
----------DISK
DISK
DISK
DISK
DISK
Completion Time
--------------24-MAR-02
24-MAR-02
27-MAR-02
27-MAR-02
27-MAR-02
#Pieces
------1
1
1
1
1
#Copies Tag
------- --1
1
1
1
1
O
e
I
A
y
l
n
s
U
To gain more detailed information from the RMAN repository, generate a report. Use the
REPORT command to answer questions such as the following:
Which files need a backup?
Which files have had unrecoverable operations performed on them?
Which backups or copies are obsolete and can be deleted?
What was the physical schema of the database at some previous time?
Which files have not been backed up recently?
The information that can be obtained from reports can be extremely important for
implementing a backup and recovery strategy. For reports to be accurate, the repository
must be synchronized with the control file and you must have run the CHANGE,
UNCATALOG, and CROSSCHECK commands recently to update the status of all backups
and copies.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
The nonexistence of any backup of a data file is not sufficient reason to consider it
unrecoverable. Such data files can be recovered through the use of the CREATE
DATAFILE command, if redo logs starting from when the file was created still exist.
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
File
---1
2
...
8
n
r
te
n
I
e
K-bytes
------307200
20480
Tablespace
---------SYSTEM
UNDOTBS
RB segs
------YES
YES
Datafile Name
----------------------------
10240
USERS
NO
/oracle/oradata/trgt/users01.dbf
cl
a
r
O
/oracle/oradata/trgt/system01.dbf
/oracle/oradata/trgt/undotbs01.dbf
This type of information is useful for incomplete recovery because you can determine the
schema of the database for the time to which you want to recover.
Oracle9i Database: Supporting Recovery Manager 5-14
y
l
n
O
e
s
U
I
A
CONFIGURE
...
CONFIGURE
CONFIGURE
CONFIGURE
CONFIGURE
CONFIGURE
&
l
a
n
r
te
n
I
e
l
c
a
r
O
O
e
I
A
y
l
n
s
U
RMAN can update the repository to show backups and copies as available or unavailable.
For example, you may have several backups on a tape drive that is being upgraded or
replaced. You can use the CHANGE...UNAVAILABLE command to mark these backups
and copies as unavailable for the duration of the maintenance on the drive. RMAN does
not consider UNAVAILABLE backups and copies for its backup and recovery operations.
When the maintenance is complete, you can issue the CHANGE...AVAILABLE
command to inform RMAN that these backups and copies are now available again. Note
that this command does not check for the existence of the files or validate the file in any
way: it merely updates the repository record to AVAILABLE. You can run CROSSCHECK
to validate the file.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
CHANGEUNCATALOG Command
O
e
I
A
y
l
n
s
U
This command removes references to a data file copy or archived redo log (but not a
backup piece or backup set) from the recovery catalog, and updates records in the target
control file to status DELETED. The CHANGE...UNCATALOG command does not touch
physical backups and copies. Use this command to notify RMAN when a file is deleted
by some means other than a DELETE command.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
Maintenance Required
When you do not use a recovery catalog, the control file is the sole source of information
about RMAN backups and copies. As you make backups and copies, the Oracle server
adds new records to the control file. What happens when the server needs to add new
records to the control file, but the oldest record is less than the value specified in
CONTROL_FILE_RECORD_KEEP_TIME?
I
A
&
l
a
The Oracle server attempts to expand the size of the control file, which it can only do if
the underlying operating system file can be expanded. If it cannot expand the control file,
then the server overwrites the oldest record, regardless of whether its age is less than the
CONTROL_FILE_RECORD_KEEP_TIME value and logs this action in the alert log.
Hence, if you are not using a recovery catalog, then set the
CONTROL_FILE_RECORD_KEEP_TIME value to slightly longer than the oldest file
that you need to keep.
If you use the control file as the sole repository of the RMAN metadata, maintain
alternate control files through multiplexing or operating system mirroring and back up the
control file frequently. If you lose the control file and do not have a backup, you lose all
information about RMAN backups and copies contained in the file. For this reason, you
should set CONFIGURE CONTROLFILE AUTOBACKUP to ON.
n
r
te
n
I
e
r
O
l
c
a
Summary
In this lesson, you should have learned how to:
Use the LIST command to display backup data
recorded in the catalog or target control file
Use the REPORT command to gather detailed
information regarding recovery catalog data
Use the CROSSCHECK and DELETE commands
Use the SHOW command to view configuration
details
Use the CHANGE command to alter the status of
object backups
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Practice Overview:
RMAN Maintenance
This practice covers the following topics:
Using the LIST command
Using the REPORT command
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Identify how RMAN makes backups to tape
Understand how the Media Management Interface
works
Identify the two versions of the SBT interface
Discuss linking the Oracle server with a media
manager
Discuss media manager issues and informational
messages
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Backups to Tape
O
e
y
l
n
s
U
Backups to Tape
To use tape storage for database backups, RMAN requires a media manager. A media
manager is a utility that loads, labels, and unloads sequential media such as tape drives for
backing up and recovering data. Oracle publishes a media management API that thirdparty vendors can use to build software that works with RMAN. To use RMAN to make
backups to sequential media such as tape, integrate media management software with
your Oracle software. Note that Oracle does not need to connect to the media
management library software when it backs up to disk.
Some media management products can manage the entire data movement between Oracle
data files and the backup devices. Such products may use technologies such as high-speed
connections between storage and media subsystems, which can remove much of the
backup load from the primary database server.
For a list of compliant vendors,and compatibility information reference the following site:
http://www.oracle.com/database/recovery/index.html?/database
/recovery/backupsp.html
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Media Manager
Media Manager Architecture
Media
Management
Server
Software
Oracle Media
Server Manager
Session Library
Recovery
Manager
Recovery
Catalog
Tape Subsystem
Control File
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
On UNIX, Oracle accesses the media management library through the UNIX shared
library libobk.so. This file must exist somewhere in the system path. It is highly
recommended that you place libobk.so in $ORACLE_HOME/lib, which is where
Oracle searches first.
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
PARMS=ENV=(NSR_SERVER=tape_srv,NSR_GROUP=oracle_tapes);
n
r
te
If you do not receive an error message, then Oracle successfully loaded the shared library.
However, channel allocation can fail with the ORA-27211 error:
RMAN-03009: failure of allocate command on c1 channel at
13:57:18
ORA-19554: error allocating device, device type: SBT_TAPE
ORA-27211: Failed to load Media Management Library
Additional information: 25
The ORA-27211 error indicates that Oracle was not able to load the media management
library that was installed. In this case, check your media management installation to make
sure that the library is correctly installed and redo. For any other errors, check the trace
file in USER_DUMP_DEST directory for more information.
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
Also, you should determine which PARMS settings are needed for the ALLOCATE
CHANNEL or CONFIGURE CHANNEL commands as well as the vendor recommended
FORMAT string for the BACKUP command (if needed). The PARMS parameter sends
instructions to the media manager. For example, the following vendor-specific PARMS
setting instructs the media manager to back up to a volume pool called oracle_tapes:
PARMS=ENV=(NSR_DATA_VOLUME_POOL=oracle_tapes)
n
I
e
r
O
l
c
a
A hanging backup usually indicates that the media manager is waiting to mount a tape.
Check if there are any media manager jobs in tape mount request mode and fix the
problem. An ORA-19511 or ORA-70 nnn error indicates that the media management
software is not correctly configured. Ensure that the steps covered previously have been
followed.
Oracle9i Database: Supporting Recovery Manager 6-10
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
2. After configuring the channel, test the backup with the following command:
RMAN> BACKUP DEVICE TYPE sbt DATAFILE 1;
3. Check your configuration by running the following command:
RMAN> SHOW CHANNEL DEVICE TYPE sbt;
4. Configure the default device to sbt. By configuring the device to sbt, RMAN
will automatically send all backups to the media manager. For example:
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
allocate channel c1
type sbt_tape
ENV=SBT_LIBRARY=oracle.disksbt,
(BACKUP_DIR=/your/backup/directory);
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
sbttest
A stand-alone program that tests if the media
management software is installed and can accept a
data stream and return an identical data stream.
sbtio.log
This is the trace file that the media management
product may use to write debugging/trace
information.
Found in the location specified by USER_DUMP_DEST
or by default on UNIX systems in
$ORACLE_HOME/rdbms/log
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
If you paste the stack above into the stack trace interpreter available on WebIV, you will
find that a sequential file was being closed when sbtinfo() was called. The
ssexhd() and ksedmp() functions are error dump routines and
sigacthandler() is a signal handling function so these can be ignored. This gives
the analyst something to proceed with.
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
In Oracle9i, the SBT disk library provided by Oracle can be loaded without removing the
existing media manager library and the library can back up to /dev/null. For example:
RUN {
ALLOCATE CHANNEL tst TYPE SBT FORMAT /dev/null
PARMS=SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/tmp);
BACKUP DATABASE; }
l
c
a
r
O
These tests are important when you suspect that the media manager library is causing
problems in Oracle server functions.
Oracle9i Database: Supporting Recovery Manager 6-22
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
The media manager library (SBT API 2.0) can return a text describing the error. The error
text is written to the RMAN output. The below example displays the error text returned
by the NetBackup implementation of SBT API 2.0:
ORA-19511: Error received from media manager layer, error
text:
sbtbackup: Failed to open for backup.
r
O
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
I
A
y
l
n
s
U
These two functions should create a backup piece at RMANs request and start the media
manager backup session. If sbtopen() or sbtbackup() fails during the backup,
then the media manager cannot create a backup piece or start a backup session. The
overwhelming majority of problems are caused by incorrect configuration of the media
manager. The following situations are common:
The environment variables specified in PARMS option are incorrect. For example,
in the case of Legato NetWorker, a wrong media pool is specified. In case of
NetBackup, the "Class" setting could be wrong.
The pool, class, or some other media manager configuration entity is not correctly
configured for Oracle backups. For example, in the case of NetBackup, the "Class"
specified by NB_ORA_CLASS is not an Oracle class. In the case of Legato, the
media pool specified by NSR_DATA_VOLUME_POOL does not exist.
The UNIX or NT user under which Oracle server sessions are running is not a valid
user in the media manager configuration. For example, in case of OmniBack II, the
user under which Oracle is running must be included in the OmniBack II UserList.
The media manager library cannot connect to the media manager server daemon
because it is not started.
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
code) in an ORA-19511. Note that some of the return codes are not errors at all like the
7504.
Oracle9i Database: Supporting Recovery Manager 6-33
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Summary
In this lesson, you should have learned how to:
Identify how Oracle makes backups to tape
Understand how the Media Management Interface
works
Identify the two versions of the SBT interface
Link the Oracle server with a media manager
Identify media manager issues and informational
messages
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Practice Overview:
Using RMAN with a Media Manager
This practice covers the following topics:
Configuring RMAN to use a media manager
Investigating media manager errors
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Debugging RMAN
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Debug RMAN errors
Debug media manager errors
Debug OS errors occurring in the RMAN stack
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
The alert log contains a chronological log of errors, initialization parameter settings, and
administration operations. Because it records values for overwritten control file records, it
can be useful for RMAN maintenance when operating without a recovery catalog.
Oracle9i Database: Supporting Recovery Manager 7-3
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
RMAN Errors
Assume that a backup of the SAMPLE tablespace was attempted. The resultant output is
shown in the slide above. What happened? The RMAN-03002 error indicates that an
RMAN command has failed, the BACKUP command, to be specific. Look at the last two
messages in the stack first and immediately the reason for the command failure is
obvious: no tablespace SAMPLE appears in the recovery catalog because the name was
mistyped. Another interesting note here is the warning issued when the two channels were
allocated for the backup. As can be seen from the output, the devices were configured to
use the Oracle test disk API to simulate an SBT tape device. Remember that this media
manager interface is provided by Oracle for testing only. Actual backup and recovery
using the oracle.disksbt library is not recommended or supported.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
SID
SERIAL#
------ -------13
75
12
81
CONTEXT
SOFAR TOTALWORK %_COMPLETE
--------- ---------- ---------- --------1
9470
15360
61.65
1
15871
28160
56.36
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
SPID EVENT
SEC_WAIT STATE
CLIENT_INFO
---- --------- -------- ------- --------------------------8642 sbtbackup
600 WAITING rman channel=ORA_SBT_TAPE_1
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Insufficient Privileges
y
l
n
O
e
s
U
Insufficient Privileges
The RMAN user created for the recovery catalog owner needs to be granted the privileges
necessary for catalog ownership. Connect to the recovery catalog database and grant
RECOVERY_CATALOG_OWNER to the RMAN user:
SQL> connect system/manager
SQL> grant RECOVERY_CATALOG_OWNER to rman;
I
A
&
l
a
Insufficient privileges at the target database is the most common source of the ORA1031 error. RMAN appends 'as sysdba' to every target connection, so the user must have
sysdba privileges. Prior to troubleshooting the error at the target, find out where they are
running RMANfrom the target database software installation, or from a different
Oracle_Home or a different system altogether.
n
r
te
n
I
e
When connecting locally to the target database, the user must be a member of the
operating system group responsible for managing SYSDBA privileges, usually DBA. If
an ORA-1031 is logged when connecting locally, make sure the username being used is
a member of the DBA group. When connecting remotely to the target database, you must
specify a username and password, along with a TNS alias, to connect to the target
database
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
Evidence that the vendor interface is not used can be found in the RMAN log. Look for an
RMAN-08503, this usually means the default Oracle test disk API software is being used.
Reasons why the backups are not written to tape when SBT_TAPE is used include:
Oracle cannot find the library to load, so it uses the dummy disk API instead.
Windows NT searches for the dll called orasbt.dll in its default directory path
(our developers recommend to the BSP members that they put their library in the
SYSTEM32 system directory).
There is an error in the vendors DLL. Either the DllMain() function returned an
error, or the vendor did not implement all of the SBT functions.
The loadsbt.exe utility can be used to diagnose why the DLL cannot be loaded. It is
available for download at ftp://dlsun336.us.oracle.com/pub/sdk.
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
SPID
---8642
8374
EVENT
--------sbtwrite2
sbtwrite2
n
I
e
n
r
te
&
l
a
SEC_WAIT STATE
-------------600 WAITING
600 WAITING
CLIENT_INFO
----------------------------rman channel=ORA_SBT_TAPE_1
rman channel=ORA_SBT_TAPE_2
l
c
a
2. Kill the hung processes with an operating system utility. For example, on Solaris
execute a kill -9 command:
$ kill -9 8642 8374
3. Check that the media manager also clears its processes, or else the next backup or
restore may still hang due to the previous hang. In some media managers, the only
solution is to shut down and restart the media manager.
r
O
ADDR
SPID
--------- -------81355388 21397
SQL> oradebug setospid 21397
SQL> oradebug event immediate trace name errorstack level 10;
Some systems have OS utilities to show a stack trace from an arbitrary process. On
Solaris, /usr/proc/bin/pstack will provide this information.
$ /usr/proc/bin/pstack 21397
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Summary
In this lesson, you should have learned how to:
Debug RMAN errors
Debug media manager errors
Debug OS errors occurring in the RMAN stack
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Practice Overview:
Debugging RMAN
This practice covers the following topics:
Analyzing RMAN errors
Analyzing media manager errors
Analyzing OS errors on the RMAN stack
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
y
l
n
s
U
Objectives
After completing this lesson, you should be able to do
the following:
Discuss general performance tips and techniques
Discuss and implement synchronous and
asynchronous I/O
Tune the RMAN BACKUP/RESTORE process
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
Tuning RMAN
O
e
y
l
n
s
U
Tuning RMAN
RMAN backup and restore operations have the following distinct components:
Reading or writing input data
Processing data by validating and copying blocks from the input to the output
buffers
The slowest of these operations is called a bottleneck. RMAN tuning is the task of
identifying the bottleneck (or bottlenecks) and attempting to make it more efficient by
using RMAN commands, initialization parameter settings, or adjustments to physical
media. The key to tuning RMAN is understanding I/O. RMANs backup and restore jobs
use two types of I/O buffers: disk and tertiary storage (usually tape). When performing
a backup, RMAN reads input files using disk buffers and writes the output backup file by
using either disk or tape buffers. When performing restores, RMAN reverses these roles.
Besides being divided into DISK and SBT, I/O is also divided into synchronous and
asynchronous. Synchronous devices only perform one I/O task at a time. Hence, you can
easily determine how much time backup jobs require. In contrast to synchronous I/O
(SIO), asynchronous I/O (AIO) can perform more than one task at a time. To tune RMAN
effectively, you must thoroughly understand concepts such as synchronous and
asynchronous I/O, disk and tape buffers, and channel architecture. When you understand
these concepts, then you can learn how to use fixed views to monitor bottlenecks.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Allocation Rule
Greater than 8
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
For example, assume that you back up two data files with one channel. You set
FILESPERSET to 3 and set MAXOPENFILES to 8. In this case, the number of files in
each backup set is 2 (the lesser of FILESPERSET and the files read by each channel),
and so the level of multiplexing is 2 (the lesser of MAXOPENFILES and the number of
files in each backup set). When RMAN backs up from disk, it uses the algorithm
described in the table above.
n
I
e
r
O
l
c
a
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
1 MB
Channel
FILESPERSET = 4
MAXOPENFILES = 4
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
Set the MAXOPENFILES parameter so that the number of files read simultaneously is
just enough to utilize the output device fully. This consideration is especially important
when the output device is tape.
r
O
l
c
a
Channel
Tape Buffers
256 kb 256 kb
256 kb 256 kb
DIGITAL DATA STORAGE
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
RMAN allocates the tape buffers in the SGA or the PGA, depending on whether I/O
slaves are used. If the initialization parameter BACKUP_TAPE_IO_SLAVES = TRUE,
then RMAN allocates tape buffers from the SGA or the large pool if the
LARGE_POOL_SIZE initialization parameter is set. If you set the parameter to false,
then RMAN allocates the buffers from the PGA. If you use I/O slaves, then set the
LARGE_POOL_SIZE initialization parameter to set aside SGA memory dedicated to
holding these large memory allocations. By doing this, the RMAN I/O buffers do not
compete with the library cache for SGA memory.
n
I
e
r
O
l
c
a
Server
Process
0100100
0100100
Tape
Buffers
4. Server process
writes data to
new buffer
3. Tape process
signals finish
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Server
Process
0100100
0100100
0100100
Tape
Buffers
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
The example above illustrates asynchronous I/O in a backup to tape. The steps that occur
in an asynchronous exchange are detailed below:
1. A server process writes blocks to a tape buffer.
2. The tape process writes data to tape. While the tape process is writing, other server
processes are free to process more input blocks and fill more output buffers.
3. Two spawned server processes write to tape buffers as the initial tape process writes
to tape.
n
I
e
r
O
l
c
a
Setting LARGE_POOL_SIZE
O
e
Setting LARGE_POOL_SIZE
I
A
y
l
n
s
U
Requests for contiguous memory allocations from the shared pool are small, usually
under 5 KB in size. It is possible however, that a request for a large contiguous memory
allocation can either fail or require significant memory housekeeping to release the
required amount of contiguous memory. Although the shared pool may be unable to
satisfy this memory request, the large pool is able to do so. The large pool does not have a
least recently used list so Oracle does not attempt to age memory out of the large pool.
Use the LARGE_POOL_SIZE initialization parameter to configure the large pool. To
see in which pool (shared pool or large pool) the memory for an object resides, query
V$SGASTAT.POOL. The Oracle9i suggested LARGE_POOL_SIZE is calculated as:
number_of_allocated_channels * (16 MB + ( 4 *
size_of_tape_buffer ))
&
l
a
n
r
te
n
I
e
l
c
a
r
O
Performance Monitoring
O
e
y
l
n
s
U
Performance Monitoring
The maximum backup speed is limited by the available hardware. It is not possible to
back up any faster than the aggregate tape bandwidth. One exception to this is if there are
many empty blocks in the data files that do not need to be backed up.
One component of the backup system is always a bottleneck: unless the speeds of the disk
and tape are exactly matched (which is not likely), I/O at one component will always
block, no matter how many buffers are used. If the bottleneck is the tape drive, and the
tape is streaming, then the backup cannot possibly proceed any faster.
Which view the SBT_TAPE row appears in is a good indication of whether the
BACKUP_TAPE_IO_SLAVES parameter is set and of course, whether AIO or SIO is
being used. This option should definitely cause increased throughput on UNIX. Because
of the memory management model, it is recommended that this be used with care on NT.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
Performance Rules
It may sound obvious to some, but you can speed the backup and restore process by
buying more tape drives, faster tape drives, or ideally a combination of the two. Generally
speaking, it is a waste of system resources to allocate more than one channel per tape
drive. If more channels than physical drives are used, then the backup sets will be
intermingled. This can adversely affect the time it takes to restore selected files.
If a tape drive is not streaming, increasing then number of files multiplexed together may
help. Be aware that if a small subset of files in a backup set must be restored, the restore
will take longer if many files are multiplexed into the backup set. Put only enough files
into each backup set to keep the tape drives streaming.It is better to store files that are
likely to be restored together in the same backup set.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
r
O
l
c
a
O
e
I
A
y
l
n
s
U
If the tape is not streaming, but the problem is not due to an incremental backup or by
backing up empty files, then try adjusting the block size of the tape buffer. You can
change the size of each tape buffer using the PARMS parameter of the ALLOCATE
CHANNEL or CONFIGURE CHANNEL command. If the BLKSIZE parameter for
PARMS is supported on your platform, then you can set it to the desired size of each
buffer. For example, configure an SBT channel as follows:
RMAN> CONFIGURE CHANNEL DEVICE TYPE SBT
PARMS="BLKSIZE=524288";
&
l
a
n
r
te
A good rule of thumb is to set BLKSIZE to a value that is a little less than the tape block
size of the media manager. What "a little less" means depends on the media manager. For
example, if the tape block size is 512 KB and the media manager has a header of size 16
KB, then you can set BLKSIZE=49600.
n
I
e
r
O
l
c
a
Note that it is also a good idea to increase the media management physical tape block
size. For example, you do not want to set the BLKSIZE parameter to 512 KB and leave
the physical tape block size as 32 KB.
Channel Tuning
Use CONFIGURE CHANNEL/ALLOCATE CHANNEL
commands to:
Limit the size of backup pieces
Prevent RMAN from consuming too much disk
bandwidth
Determine the level of multiplexing for each
channel
O
e
y
l
n
s
U
Channel Tuning
You can set various channel limit parameters that apply to operations performed by the
allocated server session in the CONFIGURE CHANNEL and ALLOCATE CHANNEL
commands.
The MAXPIECESIZE parameter specifies the maximum size of a backup piece. Use this
parameter to force RMAN to create multiple backup pieces in a backup set. RMAN
creates each backup piece with a size no larger than the value specified in the parameter.
The RATE parameter specifies the bytes per second that RMAN reads on the channel.
This parameter is useful in preventing RMAN from consuming excessive disk bandwidth
and degrading OLTP performance. For example, by setting RATE=1500K, each disk
drive delivers 3 MB per second and RMAN leaves some disk bandwidth available to the
online system.
The MAXOPENFILES parameter determines the maximum number of input files that a
backup or copy can have open at a given time. If not set manually, the value defaults to 8.
The level of RMAN multiplexing is partially determined by MAXOPENFILES. The level
of multiplexing in turn determines how RMAN allocates disk buffers. Multiplexing is the
number of input files simultaneously read and then written into the same backup piece.
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
O
e
y
l
n
s
U
I
A
&
l
a
n
r
te
n
I
e
r
O
l
c
a
Summary
In this lesson, you should have learned how to:
Apply general performance tips and techniques
Implement synchronous and asynchronous I/O
Tune the RMAN BACKUP/RESTORE process
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
__________
Appendix A
__________
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
Corresponding V$ View
View Description
RC_ARCHIVED_LOG
V$ARCHIVED_LOG
RC_BACKUP_CONTROLFILE
V$BACKUP_DATAFILE
RC_BACKUP_CORRUPTION
V$BACKUP_CORRUPTION
RC_BACKUP_DATAFILE
V$BACKUP_DATAFILE
RC_BACKUP_PIECE
V$BACKUP_PIECE
Backup pieces
RC_BACKUP_REDOLOG
V$BACKUP_REDOLOG
RC_BACKUP_SET
V$BACKUP_SET
RC_BACKUP_SPFILE
V$BACKUP_SPFILE
y
l
n
O
e
RC_CHECKPOINT
Deprecated in favor of
RC_RESYNC
I
A
s
U
RC_CONTROLFILE_COPY
V$DATAFILE_COPY
RC_COPY_CORRUPTION
V$COPY_CORRUPTION
RC_DATABASE_BLOCK_CO
RRUPTION
V$DATABASE_BLOCK_COR
RUPTION
V$DATABASE_INCARNATI
ON
RC_DATAFILE
V$DATAFILE
RC_DATAFILE_COPY
V$DATAFILE_COPY
n
I
e
n
r
te
RC_DATABASE_INCARNATI
ON
l
c
a
r
O
&
l
a
RC_LOG_HISTORY
V$LOG_HISTORY
RC_OFFLINE_RANGE
V$OFFLINE_RANGE
RC_PROXY_CONTROLFILE
V$PROXY_DATAFILE
Target Database
RMAN Executable
Catalog Database
Catalog Schema
8.0.3
8.0.3
greater/equal to 8.x
8.0.3
8.0.4
8.0.4
greater/equal to 8.x
greater/equal to 8.0.4
8.0.5
8.0.5
greater/equal to 8.x
greater/equal to 8.0.5
8.0.6
8.0.6
greater/equal to 8.x
8.0.6
8.0.6
greater/equal to 8.1.x
8.1.5
8.1.5
greater/equal to 8.1.x
8.1.6
8.0.6.1
8.1.6
8.0.6.1
r
O
8.1.7
s
U
greater/equal to 8.1.x
greater/equal to 8.1.5
8.0.6
greater/equal to 8.1.x
greater/equal to 8.1.x
5 greater/equal to
8.1.x
greater/equal to
RMAN executable
8.1.
6 greater/equal to
8.1.x
greater/equal to
RMAN executable
8.0.6.1
greater/equal to 8.x
8.0.6
8.1.
l
c
a
&
l
a
O
e
8.0.6
greater/equal to 8.x
n
r
te
n
I
e
8.1.6
8.1.6
I
A
y
l
n
8.1.7
8.0.6.1
greater/equal to 8.1.x
greater/equal to 8.1.x
8.1.7
8.1.x
greater/equal to 8.1.x
greater/equal to
RMAN executable
9.0.1
9.0.1
greater/equal to 8.1.x
greater/equal to
RMAN executable
9.2.0
greater/equal to 9.0.3
greater/equal to 8.1.x
greater/equal to
RMAN executable
Deprecated In
Deprecated Syntax
9.2
REPLICATE
9.2
SET AUTOLOCATE
9.0.1
Not available
9.0.1
9.0.1
9.0.1
ARCHIVELOG ...
LOGSEQ ...
9.0.1
9.0.1
CROSSCHECK
y
l
n
&
l
a
n
r
te
cl
n
I
e
9.0.1 ...
a
r
O
I
A
O
e
s
U
9.0.1
DELETE
9.0.1
9.0.1
SET AUXNAME
CONFIGURE AUXNAME
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
__________
Appendix B
Practices
__________
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
Lesson 2 Practices
1. Put your database in archivelog mode. Make sure the archived logs are written to
$HOME/ORADATA/ARCHIVE1.
2. On your database Unn create a tablespace called RCVCAT that will contain the schema for
the repository tables, views, etc. Make the datafile 20meg in size and place it in
$HOME/ORADATA/u04. Create a Recovery Manager user called RMAN and set the users
default tablespace to RCVCAT. Let the RMAN user have unlimited quota on this tablespace.
Set the temporary tablespace to TEMP. Grant role of RECOVERY_CATALOG_OWNER to
this user. Create the catalog and register the target database.
3. Create a persistent configuration for the recovery catalog. Use the following specifications as
a guide:
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 3 Practices
1. Using operating system commands make a complete cold backup into the directory
DONTTOUCH. This is done to provide a point of disaster recovery, should all else fail.
Confirm the copy when finished. Query the recovery catalog to see if RMAN knows about
this backup.
2. Use the CATALOG command in order to advise the repository of the backup taken previously.
Then confirm by examining the appropriate tables.
3. Use RMAN to make a datafile copy of all the files of the database. Put the files in
$HOME/BACKUP/RMAN. Then confirm that the repository was automatically updated
with the knowledge of this backup.
4. Into the directory BACKUP, make a full or incremental 0 backup of the database. Put all files
into one set, but restrict the size of each piece to 20 megabytes. Confirm the backup by
examining the appropriate tables in the repository.
5. Perform a database backup using automatic channel allocation. Make sure the backup
command behaves as specified in your persistent configuration.
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 4 Practices
Complete recovery from a total failure
1. Delete all the datafiles and controlfiles associated with the target database. Use the
V$DATAFILE and V$CONTROLFILE views to get the filenames. You can do this
individually, or by using the spool command to make a script to run. It is suggested that the
recover database validate command be run first to ensure the database can be
recovered to the current point in time.
Incomplete recovery to some time in the past
2. This practice simulates the need to recover a database to some point in the past because of
the introduction of questionable data. Create a table called HR.DEPARTMENTS2 as select
* from HR.DEPARTMENTS and perform some inserts, noting the time before committing
the inserts. Use this time (less five minutes) to recover the database to a point in time before
the new data was introduced.
Recover a Single Block
3. Using the DEPARTMENTS table, corrupt a block in the object with the corrupt.sh script
and use the BLOCKRECOVER command to fix the corruption. The script needs two
arguments; the absolute filename and block number respectively and should be run like the
example below:
$ corrupt.sh /u01/user01/ORADATA/u02/sample_01_U01.dbf 417
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 5 Practices
1. Use the LIST command to:
Identify the current database incarnation and identify the SCN at which it changed
2. Use CONFIGURE to change the REDUNDANCY to 2. Using REPORT:
Identify files that have less than 4 redundant backups.
Identify files whose recovery needs more than 7 days of archived logs.
Identify backups that are obsolete according to the new retention policy
Use REPORT to view your database schema.
3. Delete obsolete backups as identified by the redundancy value set in practice 2.
4. Create a stored script called whole_bkup that allocates a disk channel and backs up the
entire database. Run the script to be sure it works properly. Query the appropriate view to see
the script lines. Next, use the PRINT command to view the stored script lines.
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 6 Practices
1. Configure the channel SBT_TAPE to use Oracles SBT dummy disk API. Use the
SBT_LIBRARY parameter to tell RMAN the proper library to load. Configure the
SBT_TAPE channel to be the default channel. Test the SBT configuration by performing a
backup. Troubleshoot the configuration if unsuccessful.
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 7 Practices
1. Use RMAN to set a backup in progress. While the backup is running log onto the target
database using another telnet session and examine the view V$SESSION_LONGOPS. Using
this view it is possible to determine if the backup is progressing, or hanging. If all is well,
time_remaining should be decreasing.
2. Using RMAN perform another backup using the DEBUG option. On completion of the
backup script, examine the trace file produced by DEBUG.
3. Run the shell script les07_03.sh. After doing this, perform a database backup using the
SBT_TAPE device. Use the error stack to identify the problem. If it is indeterminate, look at
the files (trace files, sbtio.log) in USER_DUMP_DEST or use debug to gather more
information. Correct the error and re-run the backup to verify the repair.
4. Run the shell script les07_04.sh. After doing this, perform a database backup using the
persistent configuration. Investigate the alert log and trace files for any clues. If this proves
fruitless, use debug to gather more information. Correct the condition and run the backup.
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
__________
Appendix C
Solutions
__________
y
l
n
O
e
I
A
&
l
a
n
r
te
r
O
l
c
a
n
I
e
s
U
Lesson 2 Practices
1. Put your database in archivelog mode. Make sure the archived logs are written to
$HOME/ORADATA/ARCHIVE1.
To switch a databases archiving mode between NOARCHIVELOG and ARCHIVELOG
mode, edit your initialization parameter file and set LOG_ARCHIVE_DEST to
$HOME/ORADATA/ARCHIVE1 and LOG_ARCHIVE_START equal to TRUE. The
database should not be running.
$ cd $HOME/ADMIN/PFILE
$ vi initUnn.ora
LOG_ARCHIVE_DEST=$HOME/ORADATA/ARCHIVE1
LOG_ARCHIVE_START=TRUE
Start the instance and mount, but do not open, the database.
$sqlplus /nolog
SQL> connect / as sysdba
SQL> startup mount pfile=$HOME/oracle/dbs/initUnn.ora
y
l
n
O
e
2. On your database Unn create a tablespace called RCVCAT that will contain the schema for
the repository tables, views, etc. Make the datafile 20meg in size and place it in
$HOME/ORADATA/u04. Create a Recovery Manager user called RMAN and set the users
default tablespace to RCVCAT. Let the RMAN user have unlimited quota on this tablespace.
Set the temporary tablespace to TEMP. Grant role of RECOVERY_CATALOG_OWNER to this
user. Create the catalog and register the target database.
I
A
&
l
a
s
U
Use the create tablespace command. Name the file rcvcat.dbf and place it in
$HOME/ORADATA/u04.
n
r
te
n
I
e
l
c
a
r
O
Create the RMAN user. Make RCVCAT the default tablespace and TEMP the temporary
tablespace. Give RMAN unlimited quota in RCVCAT.
Note: In order to connect to your target database it is required that the target user be
identified as a sysdba
SQL>
2
3
User
TO rman;
Start RMAN and connect to the target database and the catalog. Create the catalog and
register the database.
SQL> exit
$ rman target / catalog rman/rman
connected to target database: U221 (DBID=4278320558)
connected to recovery catalog database
recovery catalog is not installed
RMAN> CREATE CATALOG
RMAN> create catalog
recovery catalog created
RMAN> register database;
database registered in recovery catalog
Starting full resync of recovery catalog
full resync complete
I
A
y
l
n
O
e
s
U
3. Create a persistent configuration for the recovery catalog. Use the following specifications as
a guide:
&
l
a
n
r
te
n
I
e
l
c
a
r
O
Run the appropriate configure commands to create the persistant configuration. Note
that DISK is already the default device type. Remember that the show all command
output was designed to allow easy cut and past operations to modify parameters.
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'$HOME/ORADATA/u05/%F'
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '$HOME/ORADATA/u06/snapcf_U01.f';
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '$HOME/ORADATA/u06/C1_%U';
RMAN> CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '$HOME/ORADATA/u06/C2_%U';
y
l
n
O
e
Confirm that the necessary changes have been made by issuing the show all command
again and comparing the output with the practice requirements.
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
Lesson 3 Practices
1. Using operating system commands make a complete cold backup into the directory
DONTTOUCH. This is done to provide a point of disaster recovery, should all else fail.
Confirm the copy when finished. Query the recovery catalog to see if RMAN knows about
this backup.
Shutdown your database and copy the datafiles located under the ORADATA directory to
the DONTTOUCH directory. The datafiles are on different disks (simulated) so the find
command is useful for copying files from multiple locations and collapsing them into a
single directory, DONTTOUCH in this case. Please note that there is no space between the
French braces.
$ sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> exit
$ cd
$ find $HOME/ORADATA exec
$ ls l $HOME/DONTTOUCH
total 821824
-rw-r----1 user01
dba
-rw-r----1 user01
dba
-rw-r----1 user01
dba
...
-rw-r----1 user01
dba
cp
{}
$HOME/DONTTOUCH
\;
y
l
n
O
e
Query the CDF table in the RMAN schema. The backups listed include ALL blocks and
is most like an operating system backup. In this case, there is no history of the backup at
all.
I
A
s
U
&
l
a
2. Use the CATALOG command in order to advise the repository of the backup taken previously.
Then confirm by examining the appropriate tables.
n
r
te
Run each catalog individually from the RMAN prompt or include them in a run block.
Use the output from the list command performed earlier to get the names of the datafile
copies.
l
c
a
n
I
e
SQL> exit
$ rman target / catalog
RMAN> run {
2> catalog datafilecopy
3> catalog datafilecopy
4> catalog datafilecopy
5> catalog datafilecopy
r
O
rman/rman
'$HOME/DONTTOUCH/indx01.dbf';
'$HOME/DONTTOUCH/rcvcat.dbf';
'$HOME/DONTTOUCH/example01.dbf';
'$HOME/DONTTOUCH/system01.dbf';
To confirm RMANs knowledge of the cataloged datafile copies, query the CDF table as
done previously.
$ sqlplus rman/rman
SQL> column fname format a50
SQL> select file#, fname, completion_time from cdf;
FILE# FNAME
COMPLETIO
---------- -------------------------------------------------- --------1 /home1/user01/DONTTOUCH/system01.dbf
14-APR-02
4 /home1/user01/DONTTOUCH/indx01.dbf
14-APR-02
...
3 /home1/user01/DONTTOUCH/users01.dbf
14-APR-02
6 rows selected.
3. Use RMAN to make a datafile copy of all the files of the database. Put the files in
$HOME/BACKUP/RMAN. Then confirm that the repository was automatically updated
with the knowledge of this backup.
Query V$DATAFILE to get the file numbers and filenames needed to do the RMAN
datafile backup.
SQL> column name format a45;
SQL> select file#, name from v$datafile;
FILE #
NAME
------------------------------------------------1
/home1/user01/ORADATA/u01/system01.dbf
2
/home1/user01/ORADATA/u02/undotbs01.dbf
3
/home1/user01/ORADATA/u03/users01.dbf
4
/home1/user01/ORADATA/u03/indx01.dbf
5
/home1/user01/ORADATA/u02/example01.dbf
6
/home1/user01/ORADATA/u04/rcvcat.dbf
I
A
&
l
a
y
l
n
O
e
s
U
n
r
te
Using the information from V$DATAFILE execute RMAN, connecting to the catalog
and the target database and perform the backup.
n
I
e
l
c
a
r
O
y
l
n
O
e
s
U
Query the CDF table in the RMAN schema and compare the results with the query
performed earlier. You should see a second datafile backup.
I
A
RMAN> exit
$ sqlplus rman/rman
SQL> column completion_time format a15
SQL> column fname format a45
SQL> select file#, fname, completion_time from cdf;
&
l
a
n
r
te
FILE# FNAME
COMPLETION_TIME
---------- --------------------------------------------- --------------1 /home1/user01/DONTTOUCH/system01.dbf
14-APR-02
4 /home1/user01/DONTTOUCH/indx01.dbf
14-APR-02
6 /home1/user01/DONTTOUCH/rcvcat.dbf
14-APR-02
5 /home1/user01/DONTTOUCH/example01.dbf
14-APR-02
2 /home1/user01/DONTTOUCH/undotbs01.dbf
14-APR-02
3 /home1/user01/DONTTOUCH/users01.dbf
14-APR-02
1 /home1/user01/BACKUP/RMAN/system01.dbf
14-APR-02
2 /home1/user01/BACKUP/RMAN/undotbs01.dbf
14-APR-02
3 /home1/user01/BACKUP/RMAN/users01.dbf
14-APR-02
4 /home1/user01/BACKUP/RMAN/indx01.dbf
14-APR-02
Oracle9i Database: Supporting Recovery Manager Appendix C-7
r
O
l
c
a
n
I
e
5 /home1/user01/BACKUP/RMAN/example01.dbf
14-APR-02
FILE# FNAME
COMPLETION_TIME
---------- --------------------------------------------- --------------6 /home1/user01/BACKUP/RMAN/rcvcat.dbf
14-APR-02
12 rows selected.
4. Into the directory BACKUP, make a full or incremental 0 backup of the database. Put all files
into one set, but restrict the size of each piece to 20 megabytes. Confirm the backup by
examining the appropriate tables in the repository.
Use the backup full command as shown in the example.
$ rman target / catalog rman/rman
RMAN> run {
2> allocate channel c1 type disk;
3> set limit channel c1 kbytes=20000;
4> backup full
5> (database format '$HOME/BACKUP/back_%p%d.%s');
6> release channel c1;
7> }
Starting backup at 14-APR-02
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home1/user01/ORADATA/u01/system01.dbf
...
input datafile fno=00003 name=/home1/user01/ORADATA/u03/users01.dbf
channel c1: starting piece 1 at 14-APR-02
channel c1: finished piece 1 at 14-APR-02
piece handle=/home1/user01/BACKUP/back_1U01.3 comment=NONE
...
y
l
n
O
e
I
A
s
U
&
l
a
n
r
te
n
I
e
l
c
a
r
O
5. Perform a database backup using automatic channel allocation. Make sure the backup
command behaves as specified in your persistent configuration.
Start RMAN connecting to the catalog and the target database. Issue the backup database
command. If the persistent configuration has been setup properly, the RMAN output
should be similar to the example below. Please note the two disk channels that are
allocated and the backuppiece creation.
RMAN> backup database;
Starting backup at 14-APR-02
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=10 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=11 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/home1/user01/ORADATA/u02/example01.dbf
...
channel ORA_DISK_2: starting piece 1 at 14-APR-02
channel ORA_DISK_1: finished piece 1 at 14-APR-02
piece handle=/home1/user01/ORADATA/u06/C1_0gdlvhm2_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_2: finished piece 1 at 14-APR-02
piece handle=/home1/user01/ORADATA/u06/C2_0hdlvhm2_1_1 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:25
Finished backup at 14-APR-02
Starting Control File Autobackup at 14-APR-02
piece handle=/home1/user01/ORADATA/u05/c-0574317449-20020414-00
comment=NONEFinished Control File Autobackup at 14-APR-02
y
l
n
O
e
Take notice of the channel allocation. Does the number of channels allocated match the degree of
parallelization specified for the DISK device in the persistent configuration? Note the files
created by channels 1 and 2. Does the format and file location match that specified by the
persistent configuration create earlier? In the output above, the channels are automatically
allocated as desired and the backup pieces are written in the correct format and location.
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 4 Practices
Complete recovery from a total failure
1. Delete all the datafiles and controlfiles associated with the target database. Use the
V$DATAFILE and V$CONTROLFILE views to get the filenames. You can do this
individually, or by using the spool command to make a script to run. It is suggested that the
recover database validate command be run first to ensure the database can be
recovered to the current point in time.
Run recover database validate to ensure that we can recover the database. If
this fails, backup the database again and try again.
$ rman target / catalog rman/rman
connected to target database: U01 (DBID=574317449)
connected to recovery catalog database
RMAN> restore database validate;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=10 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=7 devtype=DISK
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_2: starting validation of datafile backupset
channel ORA_DISK_1: restored backup piece 1
...
channel ORA_DISK_2: validation complete
Finished restore at 15-APR-02
O
e
y
l
n
Query V$DATAFILE and V$CONTROLFILE to find the location of the control file and
datafiles and delete them. DO NOT delete your backups. Be careful!
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Shutdown the database and remove the control file and datafiles.
Oracle9i Database: Supporting Recovery Manager Appendix C-10
SQL>
SQL>
$ cd
$ rm
$ rm
$ rm
$ rm
$ rm
shutdown immediate;
exit
$HOME/ORADATA
u01/*.dbf
u01/*.ctl
u02/*.dbf
u03/*.dbf
u04/*.dbf
Start RMAN and connect to the target database only as the recovery catalog resides in the
database and is unavailable. Start the database in nomount mode. The first thing that must
be done is to restore the control file. List the controlfiles in the autobackup location and
find the most recent one. Then use the restore controlfile from filename
command to do this.
$ sqlplus /nolog
$connect / as sysdba
SQL> startup nomount;
SQL> exit
$ rman target /
RMAN> host ls l $HOME/ORADATA/u05;
total 13328
-rw-r----1 ora9i dba
963072 Apr
-rw-r----1 ora9i dba
963072 Apr
-rw-r----1 ora9i dba
963072 Apr
-rw-r----1 ora9i dba
963072 Apr
-rw-r----1 ora9i dba
963072 Apr
-rw-r----1 ora9i dba
963072 Apr
-rw-r----1 ora9i dba
963072 Apr
host command complete
14
14
14
14
14
15
15
20:59
21:14
21:46
21:51
23:51
12:41
14:17
c-0574317449-20020414-00
c-0574317449-20020414-01
c-0574317449-20020414-02
c-0574317449-20020414-03
c-0574317449-20020414-05
c-0574317449-20020415-00
c-0574317449-20020415-01
y
l
n
O
e
s
U
I
A
&
l
a
Using RMAN restore the datafiles and recover the database. At the end of the recovery
you will need to reset the database and make a complete backup since the database will
need to be opened using the resetlogs option.
n
r
te
n
I
e
l
c
a
r
O
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
2. This practice simulates the need to recover a database to some point in the past because of
the introduction of questionable data. Create a table called HR.DEPARTMENTS2 as select *
from HR.DEPARTMENTS and perform some inserts, noting the time before committing the
inserts. Use this time (less five minutes) to recover the database to a point in time before the
new data was introduced.
n
I
e
l
c
a
r
O
$ sqlplus system/manager
SQL> create table hr.departments2 as select * from hr.departments;
SQL> select count(*) from hr.departments2;
COUNT(*)
---------27
SQL> !date
Tue Apr 16 17:05:50 EDT 2002
SQL> select sequence#, status from v$log;
SEQUENCE#
---------3
4
STATUS
---------------INACTIVE
CURRENT
Query V$LOG again to confirm the switch and then insert three lines into
DEPARTMENTS2 and commit. Confirm the number of rows in the table. These inserts
represent the introduction of questionable data into the table.
y
l
n
STATUS
---------------CURRENT
ACTIVE
O
e
I
A
s
U
&
l
a
COUNT(*)
---------30
n
r
te
n
I
e
l
c
a
r
O
Using RMAN perform an incomplete recovery until the date and time recorded in the
previous step, less five minutes. Use the set until time clause to the time reported in
the first step and then recover the database.
$ rman target /
connected to target database: U01 (DBID=574317449)
RMAN> run {
2> set until time "TO_DATE('02-APR-16:17:00:00','YY-MON-DD:HH24:MI:SS')";
3> restore database;
4> recover database;
5> }
executing command: SET until clause
using target database controlfile instead of recovery catalog
Starting restore at 16-APR-02
...
channel ORA_DISK_2: restore complete
Finished restore at 16-APR-02
Starting recover at 16-APR-02
using channel ORA_DISK_1
using channel ORA_DISK_2
starting media recovery
archive log thread 1 sequence 3 is already on disk as file
/home1/user01/ORADATA/ARCHIVE1/1_3.dbf
archive log thread 1 sequence 4 is already on disk as file
/home1/user01/ORADATA/ARCHIVE1/1_4.dbf
archive log filename=/home1/user01/ORADATA/ARCHIVE1/1_3.dbf thread=1
sequence=3
media recovery complete
Finished recover at 16-APR-02
RMAN> exit
y
l
n
O
e
I
A
s
U
Open the database with the resetlogs option and get a row count for the
DEPARTMENTS2 table. If it returns the same count as step 1, then the recovery was
successful. Always perform a reset and a backup after opening the database with the
resetlogs option. Finally, bounce the database.
&
l
a
n
r
te
n
I
e
COUNT(*)
---------27
SQL> exit
$ rman target / catalog rman/rman
RMAN> reset database;
RMAN> backup database;
RMAN> shutdown immediate;
RMAN> startup;
l
c
a
r
O
y
l
n
O
e
-rw-rw----
1 ora9i
dba
31461376 May
I
A
s
U
9 22:45 example01.dbf
Corrupt the block identified in the query above (in this case 417 in example01.dbf)
using the corrupt.sh shell script. Bounce the database to clear the buffer cache.
&
l
a
SQL> !
$ corrupt.sh /home1/user01/ORADATA/u02/example01.dbf 417
0+1 records in
0+1 records out
n
r
te
$ exit
n
I
e
l
c
a
r
O
y
l
n
$ exit
O
e
s
U
DEPARTMENT_ID DEPARTMENT_NAME
MANAGER_ID LOCATION_ID
------------- ------------------------------ ---------- ----------10 Administration
200
1700
20 Marketing
201
1800
...
250 Retail Sales
1700
260 Recruiting
1700
270 Payroll
1700
I
A
&
l
a
n
r
te
27 rows selected.
n
I
e
l
c
a
r
O
Lesson 5 Practices
1. Use the LIST command to:
Identify the current database incarnation and identify the SCN at which it changed
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size
Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------19
Full
928K
DISK
00:00:00
17-APR-02
BP Key: 20
Status: AVAILABLE
Tag:
Piece Name: /home1/user01/ORADATA/u05/c-0574317449-20020417-00
Controlfile Included: Ckp SCN: 163384
Ckp time: 17-APR-02
BS Key Type LV Size
Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------23
Full
45M
DISK
00:00:24
17-APR-02
BP Key: 25
Status: AVAILABLE
Tag:
Piece Name: /u03/ora9ir2/dbs/03dm4rji_1_1
List of Datafiles in backup set 23
File LV Type Ckp SCN
Ckp Time Name
---- -- ---- ---------- --------- ---2
5
6
y
l
n
Full 163636
Full 163636
Full 163636
17-APR-02 /home1/user01/ORADATA/u02/undotbs01.dbf
17-APR-02 /home1/user01/ORADATA/u02/example01.dbf
17-APR-02 /home1/user01/ORADATA/u04/rcvcat.dbf
O
e
s
U
I
A
1
3
4
Full 163637
Full 163637
Full 163637
&
l
a
17-APR-02 /home1/user01/ORADATA/u01/system01.dbf
17-APR-02 /home1/user01/ORADATA/u03/users01.dbf
17-APR-02 /home1/user01/ORADATA/u03/indx01.dbf
n
r
te
...
BS Key Type LV Size
Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------50
Full
928K
DISK
00:00:00
17-APR-02
BP Key: 51
Status: AVAILABLE
Tag:
Piece Name: /home1/user01/ORADATA/u05/c-0574317449-20020417-02
Controlfile Included: Ckp SCN: 167802
Ckp time: 17-APR-02
n
I
e
l
c
a
r
O
BP Key: 67
Status: AVAILABLE
Tag:
Piece Name: /home1/user01/ORADATA/u05/c-0574317449-20020417-03
Controlfile Included: Ckp SCN: 167980
Ckp time: 17-APR-02
RMAN> list backup by file;
List of Datafile Backups
========================
File Key
---- ------1
473
415
381
274
259
...
5
473
382
274
259
6
473
382
274
259
TY
B
B
B
B
B
LV
-F
F
F
F
F
S
A
A
A
A
A
Ckp SCN
---------74588
74176
70420
69997
69942
Ckp Time
--------28-MAY-02
28-MAY-02
28-MAY-02
28-MAY-02
28-MAY-02
#Pieces
------1
1
1
1
1
#Copies
------1
1
1
1
1
Tag
--TAG20020528T145408
WKLY_BKUP
TAG20020528T115053
TAG20020528T113959
TAG20020528T113852
B
B
B
B
B
B
B
B
F
F
F
F
F
F
F
F
A
A
A
A
A
A
A
A
74588
70421
69997
69942
74588
70421
69997
69942
28-MAY-02
28-MAY-02
28-MAY-02
28-MAY-02
28-MAY-02
28-MAY-02
28-MAY-02
28-MAY-02
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
TAG20020528T145408
TAG20020528T115053
TAG20020528T113959
TAG20020528T113852
TAG20020528T145408
TAG20020528T115053
TAG20020528T113959
TAG20020528T113852
Seq
------1
2
3
Low SCN
---------70236
74241
74293
Low Time
--------28-MAY-02
28-MAY-02
28-MAY-02
BS Key
------441
440
454
S
A
A
A
#Pieces
------1
1
1
&
l
a
I
A
CUR
--NO
YES
#Copies
------1
1
1
Tag
--TAG20020528T144920
TAG20020528T144920
TAG20020528T144927
O
e
s
U
Reset SCN
---------1
440227
Reset Time
---------06-MAR-02
27-MAR-02
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
I
A
0574317449-20020417-00
...
Backup Set
Backup Piece
50
51
e
t
In
e
l
c
a
r
O
a
n
r
0574317449-20020417-02
l&
17-APR-02
17-APR-02
RB segs
------YES
YES
NO
NO
NO
NO
s
U
/home1/user01/ORADATA/u05/c-
Datafile Name
------------------/home1/user01/ORADATA/u01/system01.dbf
/home1/user01/ORADATA/u02/undotbs01.dbf
/home1/user01/ORADATA/u03/users01.dbf
/home1/user01/ORADATA/u03/indx01.dbf
/home1/user01/ORADATA/u02/example01.dbf
/home1/user01/ORADATA/u04/rcvcat.dbf
4. Create a stored script called whole_bkup that allocates a disk channel and backs up the
entire database. Run the script to be sure it works properly. Query the appropriate view to see
the script lines. Next, use the PRINT command to view the stored script lines.
y
l
n
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
Issue the RMAN print script command to view the stored script lines.
Oracle9i Database: Supporting Recovery Manager Appendix C-20
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 6 Practices
Configure the channel SBT_TAPE to use Oracles SBT dummy disk API. Use the
SBT_LIBRARY parameter to tell RMAN the proper library to load. Configure the SBT_TAPE
channel to be the default channel. Test the SBT configuration by performing a backup.
Troubleshoot the configuration if unsuccessful.
First, issue the show all command to view the current configuration.
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO 'DISK';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'$HOME/ORADATA/u05/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT
'/home1/user01/ORADATA/u06/C1_%U';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT
'/home1/user01/ORADATA/u06/C2_%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home1/user01/ORADATA/u06/snapcf_U01.f';
y
l
n
Issue the configure channel command to configure the SBT_TAPE channel. Set the
SBT_LIBRARY parameter to oracle.disksbt. Configure SBT_TAPE as the default
channel.
O
e
s
U
I
A
&
l
a
n
r
te
n
I
e
l
c
a
r
O
If you receive an error, troubleshoot the configuration. Below are some common
configuration errors.
Failure to set the BACKUP_DIR parameter (required by the Oracle SBT Disk API) will
produce the following error stack:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 04/18/2002 10:42:43
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
Additional information: 4110
ORA-19511: Error received from media manager layer, error text:SBT error = 4110,
errno = 0, Oracle Test Disk API: BACKUP_DIR environment variable is not set
y
l
n
O
e
s
U
Failure to write the backup piece and the initial SBT catalog will result in this error.
Make sure that BACKUP_DIR can be written by the owner of the Oracle binaries or by
members of the DBA group.
I
A
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_SBT_TAPE_1 channel at 04/18/2002
09:58:44
ORA-19506: failed to create sequential file, name="0ndm75aj_1_1", parms=""
ORA-27028: skgfqcre: sbtbackup returned error
ORA-19511: Error received from media manager layer, error text:
sbtpvt_catalog_open: file $HOME/ORADATA/u06/Oracle_Disk_SBT_Catalog, open
error, errno = 2
&
l
a
n
r
te
n
I
e
l
c
a
r
O
An improperly configured default device will produce an error stack like this:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 04/18/2002 09:55:36
ORA-19569: no device is allocated to this session
RMAN-00600: internal error, arguments [6027] [1] [] [] []
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
Lesson 7 Practices
1. Use RMAN to set a backup in progress. While the backup is running log onto the target
database using another telnet session and examine the view V$SESSION_LONGOPS. Using
this view it is possible to determine if the backup is progressing, or hanging. If all is well,
time_remaining should be decreasing.
Start RMAN and backup the database.
$ rman target / catalog rman/rman
RMAN> backup database;
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
l
c
a
r
O
y
l
n
y
l
n
O
e
s
U
The decreasing TIME_REMAINING value indicates that this backup is progressing normally.
It is also interesting to see the server processes starting as the backup progresses. You can see
the initial process started when the backup is initiated, you can see the process associated
with the media manager starting and processing the backup and finally, the process
associated with the control file autobackups which are done to disk.
I
A
&
l
a
2. Using RMAN perform another backup using the DEBUG option. On completion of the
backup script, examine the trace file produced by DEBUG.
n
r
te
n
I
e
l
c
a
r
O
ORACLE_HOME = /u03/ora9ir2
System name:
SunOS
Node name:
stc-sun02
Release:
5.8
Version:
Generic_108528-05
Machine:
sun4u
Starting with debugging set to level=9, types=ALL
DBGSQL: EXEC SQL AT TARGET select decode(status,'OPEN',1,0) into :b1 from
v$instance
DBGSQL:
sqlcode=0
DBGSQL:
:b1 = 1
...
# Version Setting
DBGSQL: EXEC SQL AT TARGET declare vsn varchar2 ( 20 ) ; begin vsn :=
dbms_rcvman . getPackageVersion ; :pkg_vsn:pkg_vsn_i := vsn ;
if vsn is not null then :pkg_vsnub4 := to_number ( substr ( vsn , 1 , 2 ) ||
substr ( vsn , 4 , 2 ) || substr ( vsn , 7 , 2 ) ) ; en
d if ; end ;
DBGSQL:
sqlcode=0
DBGSQL:
:b1 = "08.00.04"
DBGSQL:
:b3 = 80004
...
DBGSQL: EXEC SQL AT TARGET declare vsn varchar2 ( 20 ) ; begin vsn :=
dbms_rcvman . getPackageVersion ; :pkg_vsn:pkg_vsn_i := vsn ;
if vsn is not null then :pkg_vsnub4 := to_number ( substr ( vsn , 1 , 2 ) ||
substr ( vsn , 4 , 2 ) || substr ( vsn , 7 , 2 ) ) ; en
d if ; end ;
DBGSQL:
sqlcode=0
DBGSQL:
:b1 = "09.02.00"
DBGSQL:
:b3 = 90200
...
DBGSQL: EXEC SQL AT RCVCAT select user into :b1 from dual
DBGSQL:
sqlcode=0
DBGSQL:
:b1 = "RMAN"
# Encoding the backup request
RMAN> 2> 3> 4> 5>
y
l
n
O
e
I
A
&
l
a
s
U
n
r
te
n
I
e
DBGMISC: Node # 1
DBGMISC: run
DBGMISC:
1 JCL
DBGMISC:
1 DEBUG
DBGMISC:
1 ON
DBGMISC:
2 backup
DBGMISC:
1 BSLIST
DBGMISC:
1 BSPEC
DBGMISC:
1 DBASE
DBGMISC:
3 DEBUG
DBGMISC:
1 OFF
...
l
c
a
r
O
(krmice)
3. Run the shell script les07_03.sh. After doing this, perform a database backup using the
SBT_TAPE device. Use the error stack to identify the problem. If it is indeterminate, look at
the files (trace files, sbtio.log) in USER_DUMP_DEST or use debug to gather more
information. Correct the error and re-run the backup to verify the repair.
From the operating system prompt run the les07_03.sh script. Start RMAN and backup
the database, observing any errors.
$ les07_03.sh
$ rman target / catalog rman/rman
RMAN> backup database;
starting full resync of recovery catalog
full resync complete
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on t1 channel at 05/07/2002
13:42:26
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 25
y
l
n
O
e
I
A
s
U
&
l
a
n
r
te
n
I
e
This is not correct. The SBT library that needs to be loaded is defined by the SBT_LIBRARY
parameter of the configure channel command. Use the show command to see how
it is currently defined:
l
c
a
r
O
'$HOME/ORADATA/u06/C2_%U';
y
l
n
4. Run the shell script les07_04.sh. After doing this, perform a database backup using the
persistent configuration. Investigate the alert log and trace files for any clues. If this proves
fruitless, use debug to gather more information. Correct the condition and run the backup.
O
e
s
U
After running the les07_04.sh shell script, use RMAN to perform a backup and
observer the error:
I
A
&
l
a
n
r
te
n
I
e
l
c
a
The error SVR4 Error: 13: Permission denied is an operating system error.
Running the backup again with the debug option may provide some useful information.
r
O
...
RMAN-00571:
RMAN-00569:
RMAN-00571:
RMAN-10035:
===========================================================
=============== ERROR MESSAGE STACK FOLLOWS ===============
===========================================================
exception raised in RPC:
The SVR4 (Unix System V Kernel Release 4) exception is definitely raised by the OS.
This looks suspiciously like a permissions issue. Using cd, navigate ORADATA and
inspect the u06 directory.
$ pwd
/home1/user01
$ cd ORADATA
$ ls -la
total 21316
drwxrwxr-x 10
drwxrwxrwx 10
drwxrwsr-x
2
-rw-rw---1
drwxrwsr-x
2
drwxrwsr-x
2
drwxrwsr-x
2
drwxrwsr-x
2
drwxrwsr-x
2
drwxrwsr-x
2
dr-xr-s--2
y
l
n
user01
user01
user121
user121
user121
user121
user121
user121
user121
user121
user121
dba
dba
class7
class7
class7
class7
class7
class7
class7
class7
class7
512
512
96
4096
96
96
8192
8192
96
8192
8192
May
May
May
May
May
May
May
May
May
May
May
&
l
a
n
r
te
7
7
29
29
28
30
30
30
30
29
29
17:32
17:23
17:52
14:26
16:33
06:23
06:23
06:23
06:23
17:59
17:58
I
A
O
e
.
..
ARCHIVE1
ARCHIVE15_193_0_60083.bkd
ARCHIVE2
u01
u02
u03
u04
u05
u06
s
U
Notice that there are no write privileges on u06 where the backup pieces are to be written.
Use chmod to give write privileges to the user and group and retest the backup.
l
c
a
n
I
e
r
O
512 May
7 16:18 u06