Oracle® Database Backup and Recovery User's Guide 11g Release 2 (11.2) E10642-05 July 2011 A guide to backup and recovery of Oracle databases, including RMAN backup and recovery, RMAN data transfer, Oracle Flashback Technology, and user-managed backup and recovery Oracle Database Backup and Recovery User's Guide, 11g Release 2 (11.2) E10642-05 Copyright © 2003, 2011, Oracle and/or its affiliates. All rights reserved. Primary Author: Lance Ashdown Contributors: Katherine Weill, Tammy Bednar, Anand Beldalker, Timothy Chien, Mark Dilman, Raymond Guzman, Stephan Haisley, Wei Hu, Alex Hwang, Ashok Joshi, Vasudha Krishnaswamy, J. William Lee, Valarie Moore, Muthu Olagappan, Vsevolod Panteleenko, Francisco Sanchez, Vinay Srihari, Margaret Susairaj, Mike Stewart, Steven Wertheimer, Wanli Yang, Rob Zijlstra This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065. This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services. iii Contents Preface xix What's New in Backup and Recovery? xxi Part I Overview of Backup and Recovery 1 Introduction to Backup and Recovery Purpose of Backup and Recovery 1-1 Data Protection 1-2 Data Preservation 1-3 Data Transfer 1-3 Oracle Backup and Recovery Solutions 1-3 Oracle Flashback Technology 1-5 Logical Flashback Features 1-5 Flashback Database 1-7 Data Recovery Advisor 1-7 Backup and Recovery Documentation Roadmap 1-8 Recovery Manager Documentation Roadmap 1-10 User-Managed Backup and Recovery Documentation Roadmap 1-10 2 Getting Started with RMAN Overview of the RMAN Environment 2-1 Starting RMAN and Connecting to a Database 2-2 Showing the Default RMAN Configuration 2-3 Backing Up a Database 2-4 Backing Up a Database in ARCHIVELOG Mode 2-4 Backing Up a Database in NOARCHIVELOG Mode 2-5 Typical Backup Options 2-5 Making Incremental Backups 2-6 Validating Database Files and Backups 2-7 Scripting RMAN Operations 2-8 Reporting on RMAN Operations 2-9 Listing Backups 2-9 Reporting on Database Files and Backups 2-10 Maintaining RMAN Backups 2-10 iv Cross-checking Backups 2-10 Deleting Obsolete Backups 2-11 Diagnosing and Repairing Failures with Data Recovery Advisor 2-11 Listing Failures and Determining Repair Options 2-11 Repairing Failures 2-13 Rewinding a Database with Flashback Database 2-13 Restoring and Recovering Database Files 2-14 Preparing to Restore and Recover Database Files 2-14 Recovering the Whole Database 2-15 Recovering Tablespaces 2-15 Recovering Individual Data Blocks 2-16 Part II Starting and Configuring RMAN and Flashback Database 3 Recovery Manager Architecture About the RMAN Environment 3-1 RMAN Command-Line Client 3-3 RMAN Channels 3-3 Channels and Devices 3-4 Automatic and Manual Channels 3-4 RMAN Repository 3-5 Media Management 3-6 RMAN Interaction with a Media Manager 3-6 Oracle Secure Backup 3-6 Backup Solutions Program 3-7 Fast Recovery Area 3-7 RMAN in a Data Guard Environment 3-7 RMAN Configuration in a Data Guard Environment 3-7 RMAN File Management in a Data Guard Environment 3-8 4 Starting and Interacting with the RMAN Client Starting and Exiting RMAN 4-1 Specifying the Location of RMAN Output 4-2 Setting Globalization Support Environment Variables for RMAN 4-2 Entering RMAN Commands 4-2 Entering RMAN Commands at the RMAN Prompt 4-3 Using Command Files with RMAN 4-3 Entering Comments in RMAN Command Files 4-4 Using Substitution Variables in Command Files 4-4 Checking RMAN Syntax 4-5 Making Database Connections with RMAN 4-7 About RMAN Database Connections 4-7 Making RMAN Database Connections from the Operating System Command Line 4-9 Making Database Connections from the RMAN Prompt 4-10 Connecting RMAN to an Auxiliary Database 4-11 Making RMAN Database Connections Within Command Files 4-11 v Diagnosing RMAN Connection Problems 4-12 Using the RMAN Pipe Interface 4-12 Executing Multiple RMAN Commands in Succession Through a Pipe: Example 4-13 Executing RMAN Commands in a Single Job Through a Pipe: Example 4-14 5 Configuring the RMAN Environment Configuring the Environment for RMAN Backups 5-1 Showing and Clearing Persistent RMAN Configurations 5-2 Configuring the Default Device for Backups: Disk or SBT 5-3 Configuring the Default Type for Backups: Backup Sets or Copies 5-4 Configuring Channels 5-4 Configuring Control File and Server Parameter File Autobackups 5-7 Configuring RMAN to Make Backups to a Media Manager 5-8 Prerequisites for Using a Media Manager with RMAN 5-9 Determining the Location of the Media Management Library 5-9 Configuring Media Management Software for RMAN Backups 5-10 Testing Whether the Media Manager Library Is Integrated Correctly 5-11 Configuring SBT Channels for Use with a Media Manager 5-13 Configuring the Fast Recovery Area 5-14 Overview of the Fast Recovery Area 5-14 Enabling the Fast Recovery Area 5-16 Disabling the Fast Recovery Area 5-20 Configuring Locations for Control Files and Redo Logs 5-20 Configuring RMAN File Creation in the Fast Recovery Area 5-22 Configuring the Backup Retention Policy 5-22 Configuring a Redundancy-Based Retention Policy 5-22 Configuring a Recovery Window-Based Retention Policy 5-23 Disabling the Retention Policy 5-23 Backup Optimization and the CONFIGURE command 5-24 Overview of Backup Optimization 5-24 Effect of Retention Policies on Backup Optimization for SBT Backups 5-25 Configuring Backup Optimization 5-27 Configuring an Archived Redo Log Deletion Policy 5-27 About Archived Redo Log Deletion Policies 5-27 Enabling an Archived Redo Log Deletion Policy 5-28 Configuring RMAN in a Data Guard Environment 5-29 6 Configuring the RMAN Environment: Advanced Topics Configuring Advanced Channel Options 6-1 About Channel Control Options 6-1 Configuring Specific Channel Parameters 6-2 Configuring Advanced Backup Options 6-3 Configuring the Maximum Size of Backup Sets 6-4 Configuring the Maximum Size of Backup Pieces 6-4 Configuring Backup Duplexing 6-5 Configuring Tablespaces for Exclusion from Whole Database Backups 6-6 vi Configuring Compression Options 6-6 Configuring Backup Encryption 6-8 Configuring Auxiliary Instance Data File Names 6-11 Configuring the Snapshot Control File Location 6-12 Viewing the Configured Location of the Snapshot Control File 6-12 Setting the Location of the Snapshot Control File 6-12 Configuring RMAN for Use with a Shared Server 6-12 Enabling Lost Write Detection 6-14 7 Using Flashback Database and Restore Points Understanding Flashback Database, Restore Points and Guaranteed Restore Points 7-1 Flashback Database 7-2 Flashback Database Window 7-2 Limitations of Flashback Database 7-3 Normal Restore Points 7-4 Guaranteed Restore Points 7-4 Logging for Flashback Database and Guaranteed Restore Points 7-5 Guaranteed Restore Points and Fast Recovery Area Space Usage 7-5 Logging for Guaranteed Restore Points with Flashback Logging Disabled 7-6 Logging for Flashback Database with Guaranteed Restore Points Defined 7-7 Prerequisites for Flashback Database and Guaranteed Restore Points 7-7 Using Normal and Guaranteed Restore Points 7-8 Creating Normal and Guaranteed Restore Points 7-8 Listing Restore Points 7-8 Dropping Restore Points 7-9 Using Flashback Database 7-10 Enabling Flashback Database 7-10 Disabling Flashback Database Logging 7-10 Configuring the Environment for Optimal Flashback Database Performance 7-11 Monitoring the Effect of Flashback Database on Performance 7-11 Flashback Writer (RVWR) Behavior with I/O Errors 7-12 Part III Backing Up and Archiving Data 8 RMAN Backup Concepts Consistent and Inconsistent RMAN Backups 8-1 Consistent Backups 8-1 Inconsistent Backups 8-2 Online Backups and Backup Mode 8-2 Backup Sets 8-3 Backup Sets and Backup Pieces 8-3 Block Compression for Backup Sets 8-4 Binary Compression for Backup Sets 8-4 Backup Undo 8-5 Encryption for Backup Sets 8-5 Filenames for Backup Pieces 8-5 vii Number and Size of Backup Pieces 8-6 Number and Size of Backup Sets 8-6 Multiplexed Backup Sets 8-7 Proxy Copies 8-8 Image Copies 8-9 RMAN-Created Image Copies 8-9 User-Managed Image Copies 8-10 Multiple Copies of RMAN Backups 8-10 Duplexed Backup Sets 8-11 Backups of Backups 8-11 Control File and Server Parameter File Autobackups 8-12 When RMAN Performs Control File Autobackups 8-12 How RMAN Performs Control File Autobackups 8-13 Incremental Backups 8-13 Multilevel Incremental Backups 8-14 Block Change Tracking 8-16 Incremental Backup Algorithm 8-16 Recovery with Incremental Backups 8-17 Backup Retention Policies 8-17 Recovery Window 8-18 Backup Redundancy 8-20 Batch Deletes of Obsolete Backups 8-20 Backup Retention Policy and Fast Recovery Area Deletion Rules 8-21 9 Backing Up the Database Overview of RMAN Backups 9-1 Purpose of RMAN Backups 9-1 Basic Concepts of RMAN Backups 9-1 Specifying Backup Output Options 9-2 Specifying the Device Type for an RMAN Backup 9-2 Specifying Backup Set or Copy for an RMAN Backup to Disk 9-3 Specifying a Format for RMAN Backups 9-3 Specifying Tags for an RMAN Backup 9-4 Making Compressed Backups 9-6 Backing Up Database Files with RMAN 9-6 Backing Up a Whole Database with RMAN 9-7 Backing Up Tablespaces and Datafiles with RMAN 9-7 Backing Up Control Files with RMAN 9-8 Backing Up Server Parameter Files with RMAN 9-9 Backing Up a Database in NOARCHIVELOG Mode 9-10 Backing Up Archived Redo Logs with RMAN 9-10 About Backups of Archived Redo Logs 9-10 Backing Up Archived Redo Log Files 9-12 Backing Up Only Archived Redo Logs That Need Backups 9-12 Deleting Archived Redo Logs After Backups 9-13 Making and Updating Incremental Backups 9-14 Purpose of Incremental Backups 9-14 viii Planning an Incremental Backup Strategy 9-15 Making Incremental Backups 9-16 Incrementally Updating Backups 9-16 Using Block Change Tracking to Improve Incremental Backup Performance 9-20 Making Database Backups for Long-Term Storage 9-23 Purpose of Archival Backups 9-23 Basic Concepts of Archival Backups 9-23 Making an Archival Backup for Long-Term Storage 9-24 Making a Temporary Archival Backup 9-25 Backing Up RMAN Backups 9-26 About Backups of Backups 9-26 Backing Up Backup Sets with RMAN 9-28 Backing Up Image Copy Backups with RMAN 9-29 10 Backing Up the Database: Advanced Topics Limiting the Size of RMAN Backup Sets 10-1 About Backup Set Size 10-1 Limiting the Size of Backup Sets with BACKUP MAXSETSIZE 10-2 Dividing the Backup of a Large Data File into Sections 10-2 Using Backup Optimization to Skip Files 10-3 Optimizing a Daily Archived Log Backup to a Single Tape: Scenario 10-4 Optimizing a Daily Archived Log Backup to Multiple Media Families: Scenario 10-4 Creating a Weekly Secondary Backup of Archived Logs: Example 10-5 Skipping Offline, Read-Only, and Inaccessible Files 10-6 Duplexing Backup Sets 10-6 Duplexing Backup Sets with CONFIGURE BACKUP COPIES 10-7 Duplexing Backup Sets with BACKUP COPIES 10-8 Making Split Mirror Backups with RMAN 10-8 Encrypting RMAN Backups 10-10 About RMAN Backup Encryption Settings 10-10 Making Transparent-Mode Encrypted Backups 10-11 Making Password-Mode Encrypted Backups 10-11 Making Dual-Mode Encrypted Backups 10-12 Restarting RMAN Backups 10-12 About Restartable Backups 10-12 Restarting a Backup After It Partially Completes 10-13 Managing Backup Windows 10-13 About Backup Windows 10-13 Specifying a Backup Duration 10-14 Permitting Partial Backups in a Backup Window 10-14 Minimizing Backup Load and Duration 10-14 Part IV Managing RMAN Backups 11 Reporting on RMAN Operations Overview of RMAN Reporting 11-1 ix Purpose of RMAN Reporting 11-1 Basic Concepts of RMAN Reporting 11-1 Listing Backups and Recovery-Related Objects 11-3 About the LIST Command 11-3 Listing All Backups and Copies 11-5 Listing Selected Backups and Copies 11-7 Listing Database Incarnations 11-9 Reporting on Backups and Database Schema 11-9 About Reports of RMAN Backups 11-10 Reporting on Files Needing a Backup Under a Retention Policy 11-10 Reporting on Datafiles Affected by Unrecoverable Operations 11-11 Reporting on Obsolete Backups 11-12 Reporting on the Database Schema 11-13 Using V$ Views to Query Backup Metadata 11-14 Querying Details of Past and Current RMAN Jobs 11-14 Determining the Encryption Status of Backup Pieces 11-16 Querying Recovery Catalog Views 11-16 About Recovery Catalog Views 11-16 Querying Catalog Views for the Target DB_KEY or DBID Values 11-18 Querying RC_BACKUP_FILES 11-19 12 Maintaining RMAN Backups and Repository Records Overview of RMAN Backup and Repository Maintenance 12-1 Purpose of Backup and Repository Maintenance 12-1 Basic Concepts of Backup and Repository Maintenance 12-2 Maintaining the Control File Repository 12-3 About Control File Records 12-3 Preventing the Loss of Control File Records 12-5 Protecting the Control File 12-5 Maintaining the Fast Recovery Area 12-6 Deletion Rules for the Fast Recovery Area 12-6 Monitoring Fast Recovery Area Space Usage 12-7 Managing Space for Flashback Logs in the Fast Recovery Area 12-7 Responding to a Full Fast Recovery Area 12-8 Changing the Fast Recovery Area to a New Location 12-9 Disabling the Fast Recovery Area 12-9 Responding to an Instance Crash During File Creation 12-9 Updating the RMAN Repository 12-10 Crosschecking the RMAN Repository 12-10 Changing the Repository Status of Backups and Copies 12-13 Adding Backup Records to the RMAN Repository 12-14 Removing Records from the RMAN Repository 12-17 Deleting RMAN Backups and Archived Redo Logs 12-17 Overview of RMAN Deletion 12-18 Deleting All Backups and Copies 12-20 Deleting Specified Backups and Copies 12-20 Deleting Expired RMAN Backups and Copies 12-21 x Deleting Obsolete RMAN Backups Based on Retention Policies 12-22 Dropping a Database 12-22 13 Managing a Recovery Catalog Overview of the Recovery Catalog 13-1 Purpose of the Recovery Catalog 13-1 Basic Concepts for the Recovery Catalog 13-2 Basic Steps of Managing a Recovery Catalog 13-3 Creating a Recovery Catalog 13-4 Configuring the Recovery Catalog Database 13-4 Creating the Recovery Catalog Schema Owner 13-6 Executing the CREATE CATALOG Command 13-6 Registering a Database in the Recovery Catalog 13-7 About Registration of a Database in the Recovery Catalog 13-7 Registering a Database with the REGISTER DATABASE Command 13-8 Cataloging Backups in the Recovery Catalog 13-9 Creating and Managing Virtual Private Catalogs 13-10 About Virtual Private Catalogs 13-10 Creating and Granting Privileges to a Virtual Private Catalog Owner 13-11 Creating a Virtual Private Catalog 13-12 Revoking Privileges from a Virtual Private Catalog Owner 13-12 Dropping a Virtual Private Catalog 13-13 Protecting the Recovery Catalog 13-13 Backing Up the Recovery Catalog 13-13 Recovering the Recovery Catalog 13-15 Managing Stored Scripts 13-16 About Stored Scripts 13-16 Creating Stored Scripts 13-16 Replacing Stored Scripts 13-17 Executing Stored Scripts 13-18 Creating and Executing Dynamic Stored Scripts 13-19 Printing Stored Scripts 13-20 Listing Stored Script Names 13-20 Deleting Stored Scripts 13-21 Executing a Stored Script at RMAN Startup 13-21 Maintaining a Recovery Catalog 13-21 About Recovery Catalog Maintenance 13-22 Resynchronizing the Recovery Catalog 13-22 Updating the Recovery Catalog After Changing a DB_UNIQUE_NAME 13-25 Unregistering a Target Database from the Recovery Catalog 13-26 Resetting the Database Incarnation in the Recovery Catalog 13-28 Upgrading the Recovery Catalog 13-29 Importing and Moving a Recovery Catalog 13-31 Dropping a Recovery Catalog 13-33 Part V Diagnosing and Responding to Failures [...]... system commands and SQL*Plus recovery commands.You are responsible for determining all aspects of when and how backups and recovery are done These solutions are supported by Oracle and are fully documented, but RMAN is the preferred solution for database backup and recovery RMAN provides a common Introduction to Backup and Recovery 1-3 Oracle Backup and Recovery Solutions interface for backup tasks... backup and recovery principles by reading the relevant chapter in Oracle Database Concepts 1-8 Backup and Recovery User's Guide Backup and Recovery Documentation Roadmap Figure 1–1 Backup and Recovery Documentation Roadmap 2 Day DBA Backup and Recovery Concepts (in Database Concepts) Introduction to Backup and Recovery RMAN Path Getting Started User-Managed Path Starting RMAN Backing Up the Database. .. availability of Oracle Database backup and recovery Some highlights in this release are the inclusion of Oracle's Database Backup Cloud offering, referred to as Oracle Secure Backup (OSB) Cloud Module, the addition of Expanded Backup Compression Levels, and several DUPLICATE Database Command Enhancements New Backup and Recovery Features for Oracle 11g Release 2 The following Backup and Recovery features... used at a physical standby database only if the Oracle Active Data Guard option is licensed xxiii xxiv Part I Part I Overview of Backup and Recovery The chapters in this part introduce backup and recovery and explain how to devise a backup and recovery strategy: ■ Chapter 1, "Introduction to Backup and Recovery" ■ Chapter 2, "Getting Started with RMAN" 1 1 Introduction to Backup and Recovery This chapter... to Backup and Recovery This chapter explains Oracle Database backup and recovery and summarizes the Oracle solutions This chapter contains the following topics: ■ Purpose of Backup and Recovery ■ Oracle Backup and Recovery Solutions ■ Oracle Flashback Technology ■ Data Recovery Advisor ■ Backup and Recovery Documentation Roadmap To get started with Recovery Manager (RMAN) right away, proceed to Chapter... and user-managed backup and recovery Optional paths are shown as splitting off and then rejoining each main path If you are new to Oracle Database and want to learn about backup recovery, then the best entry point is Oracle Database 2 Day DBA The backup and recovery chapter explains how to use Enterprise Manager to perform basic operations Optionally, you can expand your knowledge of basic backup and. .. RMAN." Note: Purpose of Backup and Recovery As a backup administrator, your principal duty is to devise, implement, and manage a backup and recovery strategy In general, the purpose of a backup and recovery strategy is to protect the database against data loss and reconstruct the database after data loss Typically, backup administration tasks include the following: ■ Planning and testing responses to... without physical backups Unless otherwise specified, the term backup as used in the backup and recovery documentation refers to a physical backup Backing up a database is the act of making a physical backup The focus in the backup and recovery documentation set is almost exclusively on physical backups While several problems can halt the normal operation of an Oracle database or affect database I/O operations,... database, or move an entire database from one platform to another These tasks are not strictly speaking part of a backup and recovery strategy, but they do require the use of database backups, and so may be included in the duties of a backup administrator See Also: The chapters in Part VII, "Transferring Data with RMAN" Oracle Backup and Recovery Solutions When implementing a backup and recovery strategy, you... solutions available: ■ Recovery Manager (RMAN) Recovery Manager is fully integrated with the Oracle database to perform a range of backup and recovery activities, including maintaining an RMAN repository of historical data about backups You can access RMAN through the command line or through Oracle Enterprise Manager ■ User-managed backup and recovery In this solution, you perform backup and recovery with a . xix What's New in Backup and Recovery? xxi Part I Overview of Backup and Recovery 1 Introduction to Backup and Recovery Purpose of Backup and Recovery 1-1 Data. including RMAN backup and recovery, RMAN data transfer, Oracle Flashback Technology, and user-managed backup and recovery Oracle Database Backup and Recovery