Oracle® Database
Backup and Recovery Advanced User’s Guide
10g Release 1 (10.1)
Part No. B10734-01
December 2003
Oracle Database Backup and Recovery Advanced User’s Guide, 10g Release 1 (10.1)
Part No. B10734-01
Copyright © 2003 Oracle Corporation. All rights reserved.
Primary Author: Antonio Romero
Contributing Author: Lance Ashdown
Contributors: Beldalker Anand, Tammy Bednar, Senad Dizdar, Muthu Olagappan, Francisco Sanchez,
Steve Wertheimer
Graphic Artist: Valarie Moore
The Programs (which include both the software and documentation) contain proprietary information of
Oracle Corporation; they are provided under a license agreement containing restrictions on use and
disclosure and are also protected by copyright, patent and other intellectual and industrial property
laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required
to obtain interoperability with other independently created software or as specified by law, is prohibited.
The information contained in this document is subject to change without notice. If you find any problems
in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this
document is error-free. Except as may be expressly permitted in your license agreement for these
Programs, no part of these Programs may be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation.
If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on
behalf of the U.S. Government, the following notice is applicable:
Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial
computer software" and use, duplication, and disclosure of the Programs, including documentation,
shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement.
Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer
software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR
52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500
RMAN Pipe Interface................................................................................................................... 1-6
RMAN Repository.............................................................................................................................. 1-7
Storage of the RMAN Repository in the Recovery Catalog ................................................... 1-7
Storage of the RMAN Repository in the Control File ........................................................... 1-10
iv
Media Management.......................................................................................................................... 1-11
Performing Backup and Restore with a Media Manager ..................................................... 1-11
Backup Solutions Program........................................................................................................ 1-12
2 RMAN Backups Concepts
About RMAN Channels .................................................................................................................... 2-2
Automatic and Manual Channel Allocation............................................................................. 2-3
Automatic Channel Device Configuration and Parallelism................................................... 2-4
Automatic Channel Default Device Types................................................................................ 2-5
Automatic Channel Naming Conventions................................................................................ 2-6
Automatic Channel Generic Configurations ............................................................................ 2-7
Automatic Channel-Specific Configurations............................................................................ 2-8
Clearing Automatic Channel Settings ....................................................................................... 2-8
Determining Channel Parallelism to Match Hardware Devices ........................................... 2-9
Channel Control Options for Manual and Automatic Channels......................................... 2-10
Channel Failover......................................................................................................................... 2-11
About RMAN Backups.................................................................................................................... 2-12
About Image Copies................................................................................................................... 2-12
About Proxy Copies ................................................................................................................... 2-14
Storage of Backups on Disk and Tape ..................................................................................... 2-15
Backups of Archived Logs......................................................................................................... 2-15
Multiplexed Backup Sets ........................................................................................................... 2-16
Multiplexing by the Media Manager ....................................................................................... 2-18
Manual Parallelization of Backups........................................................................................... 2-18
Multiple Copies of RMAN Backups............................................................................................. 2-20
Duplexed Backup Sets................................................................................................................ 2-20
Tests and Integrity Checks for Backups ....................................................................................... 2-58
Detecting Physical and Logical Block Corruption................................................................. 2-59
Detection of Logical Block Corruption.................................................................................... 2-59
Detection of Fractured Blocks During Open Backups .......................................................... 2-60
Backup Validation with RMAN ............................................................................................... 2-60
3 RMAN Recovery Concepts
Restoring Files with RMAN ............................................................................................................. 3-2
Mechanics of Restore Operations............................................................................................... 3-2
File Selection in Restore Operations .......................................................................................... 3-3
Restore Failover ............................................................................................................................ 3-4
Restore Optimization ................................................................................................................... 3-5
Datafile Media Recovery with RMAN ........................................................................................... 3-5
RMAN Media Recovery: Basic Steps......................................................................................... 3-5
Mechanics of Recovery: Incremental Backups and Redo Logs.............................................. 3-7
vi
Incomplete Recovery.................................................................................................................... 3-9
Tablespace Point-in-Time Recovery......................................................................................... 3-10
Block Media Recovery with RMAN.............................................................................................. 3-10
When Block Media Recovery Should Be Used....................................................................... 3-11
Block Media Recovery When Redo Is Missing....................................................................... 3-12
Database Duplication with RMAN............................................................................................... 3-13
Physical Standby Database Creation with RMAN .................................................................... 3-15
4 RMAN Maintenance Concepts
RMAN Reporting................................................................................................................................ 4-2
Using the RMAN LIST Command ............................................................................................. 4-2
RMAN Reports.............................................................................................................................. 4-3
SHOW Command Output........................................................................................................... 4-7
Crosschecks of RMAN Backups ...................................................................................................... 4-7
Monitoring RMAN Through V$ Views.......................................................................................... 4-9
Correlating Server Sessions with RMAN Channels .............................................................. 4-10
Configuring the Flash Recovery Area: Advanced Topics............................................................ 6-2
Configuring Online Redo Log Creation in the Flash Recovery Area ................................... 6-2
Configuring Control File Creation in the Flash Recovery Area ............................................ 6-2
Archived Redo Log Creation in the Flash Recovery Area...................................................... 6-3
RMAN File Creation in the Flash Recovery Area.................................................................... 6-4
Configuring RMAN to Make Backups to a Media Manager...................................................... 6-5
Prerequisites for Using a Media Manager with RMAN ......................................................... 6-5
Locating the Media Management Library: The SBT_LIBRARY Parameter......................... 6-6
Testing Whether the Media Manager Library Is Integrated Correctly................................. 6-7
Configuring Automatic Channels for Use with a Media Manager..................................... 6-11
Configuring Automatic Channels.................................................................................................. 6-12
Configuring Parallelism for Automatic Channels................................................................. 6-12
Configuring a Generic Automatic Channel for a Device Type............................................ 6-13
Showing the Automatic Channel Configuration Settings .................................................... 6-14
Configuring a Specific Channel for a Device Type................................................................ 6-16
Clearing Channel and Device Settings.................................................................................... 6-19
Configuring the Maximum Size of Backup Sets and Pieces .................................................... 6-20
Configuring Backup Optimization................................................................................................ 6-21
Configuring Backup Duplexing: CONFIGURE... BACKUP COPIES .................................... 6-22
Configuring Tablespaces for Exclusion from Whole Database Backups............................... 6-24
Configuring Auxiliary Instance Datafile Names: CONFIGURE AUXNAME ...................... 6-25
viii
Setting the Snapshot Control File Location................................................................................. 6-26
Default Location of the Snapshot Control File ....................................................................... 6-27
Viewing the Configured Location of the Snapshot Control File ......................................... 6-27
Setting the Location of the Snapshot Control File.................................................................. 6-28
Showing the Current Snapshot Control File Name............................................................... 6-28
Setting Up RMAN for Use with a Shared Server ....................................................................... 6-29
7 Making Backups with RMAN: Advanced Topics
Configuring and Allocating Channels for Use in Backups ........................................................ 7-2
Handling Errors During Backups: Example........................................................................... 7-26
8 Advanced RMAN Recovery Techniques
Performing Database Point-In-Time Recovery............................................................................. 8-2
Performing Point-in-Time Recovery with a Current Control File......................................... 8-3
Point-in-Time Recovery to a Previous Incarnation.................................................................. 8-4
Performing Recovery with a Backup Control File ....................................................................... 8-6
Performing Recovery with a Backup Control File and a Recovery Catalog........................ 8-7
Performing Recovery with a Backup Control File and No Recovery Catalog .................... 8-8
Restoring the Database to a New Host......................................................................................... 8-11
Specifying Filenames When Restoring to a New Host ......................................................... 8-12
Determining the SCN for Incomplete Recovery After Restore............................................ 8-13
Testing the Restore of a Database to a New Host: Scenario................................................. 8-13
Performing Disaster Recovery ...................................................................................................... 8-18
Performing Block Media Recovery with RMAN........................................................................ 8-21
Recovering Datablocks By Using All Available Backups..................................................... 8-21
Recovering Datablocks By Using Selected Backups.............................................................. 8-22
Recovering Blocks Listed in V$DATABASE_BLOCK_CORRUPTION ............................. 8-23
RMAN Restore and Recovery Examples...................................................................................... 8-24
Restoring Datafile Copies to a New Host: Example.............................................................. 8-24
Restoring When Multiple Databases in the Catalog Share the Same Name: Example .... 8-25
Recovering a Database in NOARCHIVELOG Mode: Example........................................... 8-27
Recovering a Lost Datafile Without a Backup: Example...................................................... 8-28
Transporting a Tablespace to a Different Database on the Same Platform: Example...... 8-29
9 Flashback Technology: Recovering from Logical Corruptions
Oracle Flashback Technology: Overview....................................................................................... 9-2
Oracle Flashback Query: Recovering at the Row Level .............................................................. 9-3
Oracle Flashback Table: Returning Individual Tables to Past States....................................... 9-4
Oracle Flashback Drop: Undo a DROP TABLE Operation ........................................................ 9-6
What is the Recycle Bin?.............................................................................................................. 9-6
How Tables and Other Objects Are Placed in the Recycle Bin.............................................. 9-6
Renaming TSPITR Recovery Set Datafiles with SET NEWNAME.................................... 10-14
Renaming TSPITR Auxiliary Set Datafiles............................................................................ 10-15
Using Image Copies for Faster TSPITR Performance.......................................................... 10-18
Customizing Initialization Parameters for the Automatic Auxiliary Instance................ 10-21
Performing RMAN TSPITR Using Your Own Auxiliary Instance ....................................... 10-22
xi
Preparing Your Own Auxiliary Instance for RMAN TSPITR............................................ 10-22
Preparing RMAN Commands for TSPITR with Your Own Auxiliary Instance ............. 10-25
Executing TSPITR with Your Own Auxiliary Instance....................................................... 10-26
Executing TSPITR With Your Own Auxiliary Instance: Scenario..................................... 10-27
Troubleshooting RMAN TSPITR ................................................................................................ 10-29
Troubleshooting TSPITR Example: Filename Conflicts...................................................... 10-29
Troubleshooting TSPITR Example: Insufficient Sort Space during Export ..................... 10-29
Troubleshooting: Restarting Manual Auxiliary Instance After TSPITR Failure ............. 10-30
11 Duplicating a Database with Recovery Manager
Creating a Duplicate Database: Overview................................................................................... 11-2
How Recovery Manager Duplicates a Database.................................................................... 11-2
Database Duplication Options.................................................................................................. 11-4
Duplicating a Database: Prerequisites and Restrictions ....................................................... 11-5
Generating Files for the Duplicate Database.............................................................................. 11-5
Creating the Duplicate Control Files ....................................................................................... 11-5
Creating the Duplicate Online Redo Logs .............................................................................. 11-5
Renaming Datafiles When Duplicating a Database .............................................................. 11-6
Skipping Read-Only Tablespaces When Duplicating a Database....................................... 11-7
Skipping OFFLINE NORMAL Tablespaces When Duplicating a Database ..................... 11-8
Preparing the Auxiliary Instance for Duplication: Basic Steps............................................... 11-9
Task 1: Create an Oracle Password File for the Auxiliary Instance .................................... 11-9
Task 2: Ensure Oracle Net Connectivity to the Auxiliary Instance..................................... 11-9
Task 3: Create an Initialization Parameter File for the Auxiliary Instance ........................ 11-9
Task 4: Start the Auxiliary Instance ....................................................................................... 11-11
Creating the Recovery Catalog ................................................................................................. 13-4
Managing Target Database Records in the Recovery Catalog.................................................. 13-5
Registering a Database in the Recovery Catalog.................................................................... 13-5
Unregistering a Target Database from the Recovery Catalog.............................................. 13-8
Resetting a Database Incarnation in the Recovery Catalog.................................................. 13-9
Removing Recovery Catalog Records with Status DELETED ........................................... 13-11
Resynchronizing the Recovery Catalog...................................................................................... 13-11
Types of Records That Are Resynchronized......................................................................... 13-12
Full and Partial Resynchronization........................................................................................ 13-12
When Should You Resynchronize?........................................................................................ 13-13
Forcing a Full Resynchronization of the Recovery Catalog ............................................... 13-14
Resynchronizing the Recovery Catalog and CONTROLFILE_RECORD_KEEP_TIME 13-15
Working with RMAN Stored Scripts in the Recovery Catalog.............................................. 13-15
Creating Stored Scripts: CREATE SCRIPT............................................................................ 13-16
xiii
Running Stored Scripts: EXECUTE SCRIPT......................................................................... 13-16
Displaying a Stored Script: PRINT SCRIPT.......................................................................... 13-17
Listing Stored Scripts: LIST SCRIPT NAMES ...................................................................... 13-18
Updating Stored Scripts: REPLACE SCRIPT ....................................................................... 13-18
Deleting Stored Scripts: DELETE SCRIPT ............................................................................ 13-19
Starting the RMAN Client and Running a Stored Script.................................................... 13-20
Restrictions on Stored Script Names ..................................................................................... 13-20
Managing the Control File When You Use a Recovery Catalog ............................................ 13-21
Backing Up and Recovering the Recovery Catalog.................................................................. 13-22
Backing Up the Recovery Catalog.......................................................................................... 13-22
Restoring and Recovering the Recovery Catalog from Backup......................................... 13-25
Re-Creating the Recovery Catalog......................................................................................... 13-25
Exporting and Importing the Recovery Catalog....................................................................... 13-26
Considerations When Moving Catalog Data........................................................................ 13-26
Exporting the Recovery Catalog............................................................................................. 13-27
Identifying Error Codes ............................................................................................................. 15-3
Interpreting RMAN Error Stacks.............................................................................................. 15-7
Identifying RMAN Return Codes .......................................................................................... 15-10
Testing the Media Management API........................................................................................... 15-10
Obtaining the sbttest Utility.................................................................................................... 15-10
Obtaining Online Documentation for the sbttest Utility .................................................... 15-11
Using the sbttest Utility ........................................................................................................... 15-11
Terminating an RMAN Command .............................................................................................. 15-13
Terminating the Session with ALTER SYSTEM KILL SESSION ....................................... 15-13
Terminating the Session at the Operating System Level .................................................... 15-14
Terminating an RMAN Session That Is Hung in the Media Manager ............................. 15-14
RMAN Troubleshooting Scenarios ............................................................................................. 15-16
After Installation of Media Manager, RMAN Channel Allocation Fails: Scenario......... 15-17
Backup Job Is Hanging: Scenario............................................................................................ 15-19
RMAN Fails to Start RPC Call: Scenario ............................................................................... 15-20
Backup Fails with Invalid RECID Error: Scenario ............................................................... 15-21
Backup Fails Because of Control File Enqueue: Scenario ................................................... 15-25
RMAN Fails to Delete All Archived Logs: Scenario............................................................ 15-27
Backup Fails Because RMAN Cannot Locate an Archived Log: Scenario ....................... 15-27
RMAN Does Not Recognize Character Set Name: Scenario.............................................. 15-28
RMAN Denies Logon to Target Database: Scenario............................................................ 15-29
Database Duplication Fails Because of Missing Log: Scenario .......................................... 15-30
Duplication Fails with Multiple RMAN-06023 Errors: Scenario ....................................... 15-31
UNKNOWN Database Name Appears in Recovery Catalog: Scenario ........................... 15-32
xv
Part III Performing User-Managed Backup and Recovery
16 Making User-Managed Backups
Querying V$ Views to Obtain Backup Information.................................................................. 16-2
Listing Database Files Before a Backup................................................................................... 16-2
Determining Datafile Status for Online Tablespace Backups .............................................. 16-3
Performing Flashback Database with SQL*Plus .................................................................... 17-2
About User-Managed Restore Operations................................................................................... 17-3
Determining Which Datafiles Require Recovery ....................................................................... 17-4
Restoring Datafiles and Archived Redo Logs.............................................................................. 17-5
Restoring Datafiles with Operating System Utilities............................................................. 17-6
Restoring Archived Redo Logs with Operating System Utilities........................................ 17-6
Restoring Control Files.................................................................................................................... 17-8
Losing a Member of a Multiplexed Control File.................................................................... 17-8
Losing All Current Control Files When a Backup Is Available ........................................... 17-9
Losing All Current and Backup Control Files ...................................................................... 17-12
About User-Managed Media Recovery ...................................................................................... 17-14
Preconditions of Performing User-Managed Recovery ...................................................... 17-14
Applying Logs Automatically with the RECOVER Command......................................... 17-15
Recovering When Archived Logs Are in the Default Location ......................................... 17-17
Recovering When Archived Logs Are in a Nondefault Location...................................... 17-18
Resetting the Archived Log Destination ............................................................................... 17-18
Overriding the Archived Log Destination............................................................................ 17-19
Responding to Unsuccessful Application of Redo Logs..................................................... 17-20
Interrupting User-Managed Media Recovery ...................................................................... 17-20
Performing Complete User-Managed Media Recovery .......................................................... 17-21
Performing Closed Database Recovery................................................................................. 17-21
Performing Datafile Recovery in an Open Database........................................................... 17-24
Performing Incomplete User-Managed Media Recovery ....................................................... 17-27
Preparing for Incomplete Recovery ....................................................................................... 17-28
Restoring Datafiles Before Performing Incomplete Recovery............................................ 17-28
Performing Cancel-Based Incomplete Recovery.................................................................. 17-30
Performing Time-Based or Change-Based Incomplete Recovery...................................... 17-32
Opening the Database with the RESETLOGS Option............................................................ 17-33
About Opening with the RESETLOGS Option..................................................................... 17-33
Executing the ALTER DATABASE OPEN Statements ....................................................... 17-35
Preparing for Tablespace Point-in-Time Recovery: Basic Steps ............................................. 19-4
Step 1: Review TSPITR Requirements..................................................................................... 19-5
Step 2: Identify All of the Files in the Recovery and Auxiliary Set Tablespaces............... 19-5
Step 3: Determine Whether Objects Will Be Lost................................................................... 19-6
Step 4: Choose a Method for Connecting to the Auxiliary Instance ................................... 19-7
Step 5: Create an Oracle Password File for the Auxiliary Instance..................................... 19-7
Step 6: Create the Initialization Parameter File for the Auxiliary Instance........................ 19-7
xviii
Restoring and Recovering the Auxiliary Database: Basic Steps............................................ 19-10
Restoring and Recovering the Auxiliary Database on the Same Host ............................. 19-10
Restoring the Auxiliary Database on a Different Host with the Same Path Names....... 19-12
Restoring the Auxiliary Database on a Different Host with Different Path Names....... 19-14
Performing TSPITR with Transportable Tablespaces ............................................................. 19-14
Step 1: Unplugging the Tablespaces from the Auxiliary Database................................... 19-14
Step 2: Transporting the Tablespaces into the Primary Database ..................................... 19-15
Performing Partial TSPITR of Partitioned Tables ................................................................... 19-16
Step 1: Create a Table on the Primary Database for Each Partition Being Recovered.... 19-17
Step 2: Drop the Indexes on the Partition Being Recovered............................................... 19-17
Step 3: Exchange Partitions with Standalone Tables........................................................... 19-17
Step 4: Drop the Recovery Set Tablespace ............................................................................ 19-18
Step 5: Create Tables at Auxiliary Database ......................................................................... 19-18
Step 6: Drop Indexes on Partitions Being Recovered .......................................................... 19-18
Step 7: Exchange Partitions with Standalone Tables on the Auxiliary Database............ 19-18
Step 8: Transport the Recovery Set Tablespaces .................................................................. 19-19
Step 9: Exchange Partitions with Standalone Tables on the Primary Database .............. 19-19
Step 10: Back Up the Recovered Tablespaces in the Primary Database ........................... 19-19
Performing TSPITR of Partitioned Tables When a Partition Has Been Dropped ............. 19-19
Step 1: Find the Low and High Range of the Partition that Was Dropped...................... 19-20
Step 2: Create a Temporary Table .......................................................................................... 19-20
Step 3: Delete Records From the Partitioned Table ............................................................. 19-20
■
Is the information clearly presented?
■
Do you need more information? If so, where?
■
Are the examples correct? Do you need more examples?
■
What features did you like most?
If you find any errors or have any other suggestions for improvement, please indicate the document
title and part number, and the chapter, section, and page number (if available). You can send com-
ments to us in the following ways:
■
Electronic mail:
■
FAX: (650) 506-7227 Attn: Server Technologies Documentation Manager
■
Postal service:
Oracle Corporation
Server Technologies Documentation
500 Oracle Parkway, Mailstop 4op11
Redwood Shores, CA 94065
USA
If you would like a reply, please give your name, address, telephone number, and (optionally) elec-
tronic mail address.
If you have problems with the software, please contact your local Oracle Support Services.
xxii
xxiii
Preface
This preface contains these topics:
■
Chapter 1, "Recovery Manager Architecture"
This chapter describes the application architecture of the RMAN environment.
Chapter 2, "RMAN Backups Concepts"
This chapter describes how to start RMAN and connect to target, catalog, and
auxiliary databases.
Chapter 3, "RMAN Recovery Concepts"
This chapter describes basic concepts involved in RMAN restore, recovery, and
database duplication.
Chapter 4, "RMAN Maintenance Concepts"
This chapter describes basic concepts involved in maintaining the RMAN
repository.
xxv
Part II, "Performing Advanced RMAN Backup and Recovery"
This section describes advanced procedures for using RMAN.
Chapter 5, "Connecting to Databases with RMAN"
This chapter gives detailed information for how to connect to databases with
RMAN.
Chapter 6, "Configuring the RMAN Environment: Advanced Topics"
This chapter describes advanced configurations in the RMAN environment.
Chapter 7, "Making Backups with RMAN: Advanced Topics"
This chapter describes detailed procedure for using the BACKUP command.
Chapter 8, "Advanced RMAN Recovery Techniques"
This chapter includes advanced scenarios and techniques using the RESTORE and
RECOVER commands.
Chapter 9, "Flashback Technology: Recovering from Logical Corruptions"
This chapter describes the Flashback features of the Oracle database, and their use
in a data recovery context.
Chapter 10, "RMAN Tablespace Point-in-Time Recovery (TSPITR)"
This chapter describes how to recover one or more tablespaces to a past point in
time without affecting the rest of the database.