Oracle9i Database: Advanced Backup and Recovery Using RMAN Student Guide D16507GC10 Production 1.0 March 2003 D37796
Author Jim Womack Technical Contributors and Reviewers Matthew Arrocha Tammy Bednar Dairy Chen Phillip Garm Joel Goodman Lex De Haan Matthew Hart Magnus Isaksson Donna Keesling Petter Stene Sabine Teuber Publisher Michael Sebastian Copyright Oracle Corporation, 2003. All rights reserved. This documentation contains proprietary information of Oracle Corporation. It is provided under a license agreement containing restrictions on use and disclosure and is also protected by copyright law. Reverse engineering of the software is prohibited. If this documentation is delivered to a U.S. Government Agency of the Department of Defense, then it is delivered with Restricted Rights and the following legend is applicable: Restricted Rights Legend Use, duplication or disclosure by the Government is subject to restrictions for commercial computer software and shall be deemed to be Restricted Rights software under Federal law, as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013, Rights in Technical Data and Computer Software (October 1988). This material or any portion of it may not be copied in any form or by any means without the express prior written permission of Oracle Corporation. Any other copying is a violation of copyright law and may result in civil and/or criminal penalties. If this documentation is delivered to a U.S. Government Agency not within the Department of Defense, then it is delivered with Restricted Rights, as defined in FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987). 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. All references to Oracle and 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.
Contents 1 Overview of Recovery Manager (RMAN) Objectives 1-2 RMAN 1-3 RMAN Features 1-4 RMAN Architecture 1-6 The RMAN Environment 1-7 RMAN and Enterprise Manager 1-8 RMAN Version Compatibility 1-9 RMAN Components 1-10 RMAN Utility Executable 1-12 RMAN Executable: The recover.bsq File 1-13 Recovery Catalog 1-14 Target Database: Control File Tables and Views 1-15 Target Database: DBMS_BACKUP_RESTORE 1-16 Channels and Media Manager Server 1-18 Running RMAN Commands 1-19 RMAN Usage Considerations 1-20 Simple Backup and Recovery Concepts 1-22 Database Inconsistency 1-24 Comparing Redo and Undo 1-26 Redo and Undo Generation 1-27 Recovery Concepts 1-28 Differences Between Crash and Media Recovery 1-29 Stuck Recovery 1-31 NOLOGGING and Recovery 1-32 Summary 1-33 2 Configuring RMAN Objectives 2-2 RMAN Configuration Decisions 2-3 Issues to Consider 2-4 Using RMAN Without a Recovery Catalog 2-5 Creating the Recovery Catalog 2-6 Creating a Recovery Catalog 2-7 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 iii
Catalog Maintenance Commands 2-16 RESYNC CATALOG Command 2-17 Control File Record Types 2-18 Recovery Catalog Resync Types 2-19 When to Run a RESYNC CATALOG 2-20 Resync and Snapshot Control Files 2-21 Persistent RMAN Configuration Parameters 2-23 Retention Policies 2-24 The CONFIGURE RETENTION POLICY Command 2-25 The CONFIGURE CHANNEL Command 2-26 Automatic Channel Allocation 2-27 Channel Allocation By Using Enterprise Manager 2-28 CONFIGURE CONTROLFILE AUTOBACKUP 2-29 CONFIGURE SNAPSHOT CONTROLFILE and CONFIGURE AUXNAME 2-30 Other Configuration Commands 2-31 Calling Configuration Sets 2-32 The CATALOG Command 2-33 Catalog of Consistent and Inconsistent Copies 2-34 Recovery Catalog Compatibility 2-35 Determine the Schema Version of the Recovery Catalog 2-36 Upgrading Recovery Catalog 2-37 Dropping the Recovery Catalog 2-38 Summary 2-39 Practice Overview: Configuring RMAN 2-40 3 Backups with RMAN Objectives 3-2 RMAN Backups 3-3 Running the BACKUP Command 3-4 Backup Tags 3-6 RMAN-Managed Backups 3-7 Parallelization of File Copies 3-8 Backup Sets 3-9 Backup Set: Example 3-10 Archivelog Backup Sets 3-11 Multiplexed Backup Sets 3-12 Parallelization of Backup Sets 3-13 Creating a Backup Set with Enterprise Manager 3-15 Backup Pieces 3-16 Backup Piece Contents 3-17 Incremental Data File Backup 3-18 Cumulative Incremental Backups 3-19 SCN and Incremental Backups 3-20 Basic Backup Algorithm 3-21 Algorithm Rules 3-22 Advanced Algorithm 3-24 Algorithm Behavior for Standard Backup Sets 3-25 iv
Algorithm Behavior for Archivelog Backup Sets 3-27 Algorithm Behavior for File Copies 3-28 Backup Optimization 3-29 Backup Optimization Algorithm 3-30 Duplexed Backups 3-32 Mirrored Backups 3-35 Proxy Copy 3-36 Backup Set Backup 3-37 Archived Log Backups 3-38 Archived Log Backup Methods 3-39 Long-Term Backups 3-40 Performing Test Backups by Using RMAN 3-41 Restarting a Backup 3-43 Default Autolocation for RAC Clusters 3-44 Summary 3-45 Practice Overview: Backups with RMAN 3-46 4 Restore and Recovery with RMAN Objectives 4-2 The RESTORE Command 4-3 Steps in the RESTORE Process 4-4 File Selection When Restoring 4-5 Restore Optimization 4-6 Restoring Data Files and Tablespaces 4-7 Restoring to a New Location 4-8 Restoring Archived Logs 4-9 Restoring the Server Parameter File 4-10 Restoring the Database to a New Host 4-12 Create Standby Database with DUPLICATE 4-14 Validating Restore of Backups and Copies 4-15 Restore Autolocation 4-17 Restore When All Is Lost 4-18 RMAN Media Recovery Steps 4-20 RMAN Recovery Phases 4-21 Recover Database with Recovery Wizard 4-23 Tablespace Recovery with Recovery Wizard 4-24 RMAN Incomplete Database Recovery 4-25 DBPITR with Enterprise Manager 4-26 Specifying the Sequence 4-27 Block Media Recovery (BMR) 4-28 The BLOCKRECOVER Command 4-29 v
RMAN BMR Interface 4-31 Trial Recovery 4-32 Tablespace Recovery: Example 4-33 Recover Database: Example 4-34 Performing Incomplete Recovery by Using UNTIL TIME: Example 4-36 Performing Incomplete Recovery by Using UNTIL SEQUENCE: Example 4-38 Recovering a NOARCHIVELOG Database: Example 4-39 Examples of BLOCKRECOVER 4-40 Summary 4-42 Practice Overview: Restore and Recovery with RMAN 4-43 5 RMAN Maintenance Objectives 5-2 RMAN Catalog Maintenance 5-3 The 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 CHANGE UNAVAILABLE and CHANGE AVAILABLE Commands 5-16 The CHANGE UNCATALOG Command 5-17 Deleting Specified Backups and Copies 5-18 Delete 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 6 Using RMAN with a Media Manager Objectives 6-2 Backups to Tape 6-3 Media Manager 6-4 Media Manager Prerequisites 6-5 Linking a Media Manager on UNIX 6-6 Linking a Media Manager on NT 6-8 Testing the Media Manager Installation 6-9 Performing a Test Backup to Tape 6-10 Testing Automatic Channels and MML 6-11 Default SBT Interface 6-13 Events in a Media Manager Backup 6-14 Events in a Media Manager Restore 6-16 Media Manager Diagnostics 6-18 vi
Troubleshooting: Media Manager or RMAN 6-19 Troubleshooting Media Manager 6-26 SBTINIT and SBTINIT2 Function Errors 6-28 SBTOPEN or SBTBACKUP Failures 6-30 SBTOPEN or SBTRESTORE Failures 6-31 SBTWRITE or SBTREAD Failures 6-32 SBT API Return Codes 6-33 Vendor Differences 6-34 Summary 6-35 Practice Overview: Using RMAN with a Media Manager 6-36 7 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 RMAN 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 the Media Manager 7-22 RPC Call Fails 7-24 Failure of Snapshot Control File Creation 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 8 RMAN Performance Tuning Objectives 8-2 Tuning RMAN 8-3 Allocating RMAN Disk Buffer 8-4 Allocating Disk Buffer: Example 8-5 Allocating Tape Buffer 8-6 Synchronous Versus Asynchronous I/O 8-7 Setting LARGE_POOL_SIZE 8-9 Performance Monitoring 8-10 vii
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 Channel Tuning 8-18 Tuning the BACKUP Command 8-19 Summary 8-20 Appendix A Appendix B - Practices Appendix C - Solutions viii