1 Oracle Database 10g RMAN Backup & Recovery by Matthew Hart and Robert G. Freeman Oracle Press © 2007 (696 pages) CitationISBN:9780072263176 1. Deploy a rock-solid data backup and disaster recovery strategy with the in-depth guidance of this authoritative text. Learn how to set up RMAN-ready databases, create reliable backup tapes and discs, and perform accurate Oracle system restores. TOC Introduction 13 Answering the Question…and Asking a New One 13 A Book for the DBA and the Sys Admin 13 RMAN: An Evolution into Excellence 14 What This Book Covers 14 Using This Book Effectively 14 RMAN Workshops 15 Part I: Getting Started with RMAN in Oracle Database 10g 15 Chapter List 16 Chapter 1: Oracle Database 10g Backup and Recovery Architecture Tour 16 Overview 16 Backup and Recovery Essentials 17 High Availability 17 Backup and Recovery 17 A Few Oracle Terms to Know 18 Controlling the Database Software 20 Oracle Architecture 21 The Oracle Processes 21 Oracle Memory and RMAN 22 The Oracle Database 23 ARCHIVELOG Mode vs. NOARCHIVELOG Mode 25 Oracle Logical Structures 25 The Combined Picture 25 Startup and Shutdown of the Database 25 Using the Database and Internals 27 Oracle Backup and Recovery Primer 29 Logical Backup and Recovery 29 Oracle Physical Backup and Recovery 30 2 Backing Up Other Oracle Components 33 Summary 34 Chapter 2: Introduction to the RMAN Architecture 34 Server-Managed Recovery 34 The RMAN Utility 35 RMAN and Database Privileges 35 The Network Topology of RMAN Backups 36 Running RMAN Remotely 36 Running RMAN Locally from the Target Database’s ORACLE_HOME 37 The Database Control File 38 Record Reuse in the Control File 39 The Snapshot Control File 40 The RMAN Server Processes 41 RMAN Channel Processes 41 The SYS Packages Used by RMAN 42 SYS.DBMS_RCVMAN 42 SYS.DBMS_BACKUP_RESTORE 42 Backing Up the Data Block 43 The Data Block Backup Overview 43 The Benefits of Block-Level Backups 43 RMAN in Memory 44 Input Memory Buffers 45 Memory Buffers on Restore 46 RMAN Memory Utilization: PGA vs. SGA 46 The Recovery Catalog 47 The Auxiliary Database 48 Compatibility Issues 49 The Target and the RMAN Executable 49 The Catalog Database and Catalog Schema 50 The Auxiliary Database 50 The RMAN Process: From Start to Finish 50 The Flash Recovery Area 52 Summary 52 Part II: Setup Principles and Practices 53 Chapter List 53 Chapter 3: RMAN Setup and Configuration 53 Configuring Your Database to Run in ARCHIVELOG Mode 53 ARCHIVELOG Destination Directories 53 The Flash Recovery Area 54 Should You Use the FRA? 59 Switching Between ARCHIVELOG Modes 59 If You Created Your Database with the Oracle Database Configuration Assistant 59 RMAN Workshop: Put the Database in ARCHIVELOG Mode 59 The RMAN Command Line 61 Connecting via the RMAN Command Line 61 Using the RMAN connect Command 63 Exiting the RMAN Client 63 Configuring the Database for RMAN Operations 63 Setting Up the Database User 63 RMAN Workshop: Create the Target Database RMAN Backup Account 64 Setting Up Database Security 64 Setting the CONTROL_FILE_ RECORD_KEEP_TIME Parameter 65 Configuring RMAN Default Settings 66 3 If You Are Using Shared Servers 75 Summary of RMAN Configuration Tasks 75 The Recovery Catalog 76 What Is the Recovery Catalog? 76 Creating the Recovery Catalog 77 RMAN Workshop: Create the Recovery Catalog User Account 77 RMAN Workshop: Create the Recovery Catalog 78 RMAN Workshop: Register Your Database in the Recovery Catalog 78 Backing Up and Recovering the Recovery Catalog 80 Other Backup and Recovery Setup and Configuration Considerations 80 Summary 80 Chapter 4: Media Management Considerations 80 Overview 80 Tape Backups in a Disk Backup World 81 RMAN and the Media Manager: An Overview 82 The Media Manager Catalog 83 The Media Manager: Other Software Components 83 Media Management Library 83 RMAN Workshop: Test Tape Channels with the Oracle Default SBT Interface 84 Interfacing with the MML 85 The SBT API 85 Back Up to Tape: From Start to Finish 86 Restore from Tape: From Start to Finish 87 Using sbttest and loadsbt.exe 87 Media Management Errors 88 Summary 89 Chapter 5: Oracle Secure Backup 89 Features of Oracle Secure Backup 89 Oracle Secure Backup and Recovery Manager 89 Differences Between OSB and OSB Express 90 Backup Encryption 90 Oracle Secure Backup Interfaces 90 Oracle Secure Backup Components 91 Host Access Modes 92 Administrative Data 93 Oracle Secure Backup Users and Classes 93 Operating System Accounts 94 NDMP Hosts 94 Oracle Secure Backup Rights and Classes 94 Installing Oracle Secure Backup 95 RMAN Workshop: Install Oracle Secure Backup 96 Enterprise Manager and Oracle Secure Backup 99 RMAN Workshop: Configuring and Using Enterprise Manager for OSB Backups 100 Submitting Oracle Secure Backup Jobs from RMAN 105 Configuring Backup Storage Selectors with Enterprise Manager 106 Oracle Secure Backup File System Backup and Restore 108 Summary 108 Chapter 6 : Enhancing RMAN with VERITAS NetBackup™ for Oracle 108 Key Features 109 Necessary Components 109 Storage/Media Device Configuration 109 NetBackup Installation 110 Pre-Installation Tasks for NetBackup for Oracle Agent 111 4 NetBackup for Oracle Agent Installation Steps 111 How to Link Oracle to NetBackup Media Manager 112 Automatic Link Method 112 Manual Link Method 112 Architecture 113 Configuring NetBackup Policies 114 Adding New Policies 114 Defining Schedules 116 Defining a Backup Selection 118 Defining Policy Clients 119 Managing Expired Backup Images 120 Delete Expired Backups Using NetBackup Repository 120 Delete Expired Backups Using RMAN 120 RMAN Sample Scripts 120 Troubleshooting 121 Use NetBackup Logs 121 Determine Which Library Is in Use 122 Security Best Practices 122 Cost Justification 123 Summary 123 References 123 Chapter 7: Configuring EMC NetWorker Module for Oracle 123 Architecture of the Oracle and NetWorker Backup and Recovery System 124 Backup and Restore Operations 125 Installing NMO 125 RMAN Workshop: NMO Installation 126 Configuring NetWorker for Client Operating System Backups 127 RMAN Workshop: Configure NetWorker for OS-Level Backups 127 Running and Scheduling RMAN Backups 129 RMAN Workshop: Configuration of the nsrnmo.SID Script 129 Configuring NMO for Oracle Backups 129 Creating RMAN Backup Scripts 130 Restore Commands 132 NSR Environment Variables 133 Summary 133 Chapter 8: RMAN and Tivoli Storage Manager 133 Overview of Tivoli Storage Manager 134 TSM Server System Objects 135 TSM Client 136 TSM Administration Center and Web Client 136 TSM Installation Tasks 137 Storage Manager for Linux Server 137 IBM Integrated Solutions Console 137 Storage Manager Administration 138 TSM for Databases 138 Configuration Tasks 139 Creating a TSM Administrator Account 139 Registering a TSM Client 139 Adding a Server to ISC 140 Adding a Storage Device 141 Configuring TDPO 143 Performing an RMAN Backup Using TDPO 146 Summary 149 5 Part III: Using RMAN Effectively 149 Chapter List 149 Chapter 9: RMAN Backups 149 Benefits of RMAN Backups vs. Scripted Backups 150 RMAN Compatibility Issues 150 Monitoring RMAN Backup Status 151 Offline RMAN Database Backups 152 Offline Backups Using Default Settings 152 RMAN Workshop: Do an Offline Backup 152 Offline Backups Without Using Configured Defaults 154 Backup Command Options 157 Compression 157 Tags 158 Limiting Backup Impacts 158 Limiting the Size of a Backup Set 158 Modifying the Retention Policy for a Backup Set 159 Overriding the configure exclude Command 159 Checking the Database for Errors with the backup Command 159 Skipping Offline, Inaccessible, or Read-Only Datafiles 160 Forcing a Backup of Read-Only Datafiles 160 Backing Up Datafiles Based on Their Last Backup Time 160 Checking for Logical Corruption During a Backup 161 Making Copies of Backups on Your RMAN Copier 161 Capturing the Elusive Control File 161 Introducing the Set Command 162 Online RMAN Database Backups 162 Online Database Backups 163 RMAN Workshop: Do an Online Backup 163 Tablespace Backups 164 Datafile Backups 165 Archived Redo Log Backups 165 Control File and Parameter File Backups 166 Backup Set Backups 166 Flash Recovery Area Backups 167 Copies 167 Introducing Image Copies 167 Database, Tablespace, and Datafile Image Copies 167 Control File Copies 168 ARCHIVELOG Image Copies 168 Incremental RMAN Backups 168 The Block Change Tracking File 169 The Base Backup 169 Differential vs. Incremental Backups 170 RMAN Workshop: Do an Incremental Backup 172 Getting Started 172 RMAN Workshop: Get Your Database Backed Up! 172 Summary 174 Chapter 10: RMAN Restore and Recovery 174 RMAN Restore and Recovery Basics 175 Before You Can Restore the Database 176 Before RMAN Can Get Going 176 Restoring the SPFILE 177 Restoring the Control File 180 6 RMAN Workshop: Recover Your Control File 185 The Restore and Recover Commands 186 The restore Command 186 The recover Command 187 Restore and Recover the Database in NOARCHIVELOG Mode 187 Preparing for the Restore 187 Restoring from an Older Backup 188 Restoring to a Different Location 189 RMAN Workshop: Recover Your NOARCHIVELOG Mode Database 190 Database Recoveries in ARCHIVELOG Mode 191 Point-of-Failure Database Recoveries 191 RMAN Workshop: Complete Recovery of Your ARCHIVELOG Mode Database 193 Tablespace Recoveries 194 Datafile Recoveries 195 What If I Use Incremental Backups? 195 Summary 196 Chapter 11: Using Oracle Enterprise Manager for Backup and Recovery 196 Oracle Enterprise Manager 10g: The New Paradigm 196 Grid Control 199 The Grid Control Architecture 199 Installing and Configuring Grid Control 200 Resource Considerations 201 The Oracle Universal Installer 201 The Configuration Assistants 202 Installing the Central Agent 203 RMAN Workshop: Starting and Stopping All Grid Control Components 204 Database Control 205 The Database Control Architecture 205 Installing and Configuring Database Control 206 Using the Database Configuration Assistant to Configure Database Control 206 Using Enterprise Manager Configuration Assistant to Configure Database Control 207 RMAN Workshop: Configure Database Control Using emca 207 Configuring Backup Settings in Enterprise Manager 208 Device Configuration 209 Backup Set Configuration 210 Policy Settings 210 What Is Missing from OEM’s Backup Configuration? 211 RMAN Workshop: Configure Backup Settings in OEM 211 Configuring Recovery Settings 212 Instance Recovery 213 Media Recovery 213 Flash Recovery 214 RMAN Workshop: Configure Recovery Settings in OEM 215 Configuring Recovery Catalogs in OEM 216 RMAN Workshop: Register the Recovery Catalog with OEM 216 Database Backups from Enterprise Manager 218 Oracle-Suggested Backup Strategy 218 Scheduling a Customized Backup 220 RMAN Script Job vs. Scheduled Backup Wizard 221 RMAN Workshop: Create an RMAN Script Job in OEM 221 Performing Recovery in Enterprise Manager 223 Whole Database Recovery 223 RMAN Workshop: Perform Database Recovery from OEM 225 7 Object Level Recovery 227 Backup Management and Reporting 227 Managing Current Backups 227 Managing Restore Points 228 Creating Backup Reports 229 Database Cloning from Enterprise Manager 229 Summary 231 Chapter 12: RMAN Advanced Recovery Topics 231 Incomplete Recoveries 231 Using the resetlogs Command 232 Establishing a Point to Recover To 232 Time-Based Recovery 233 SCN-Based Recovery 233 Log Sequence—Based Recovery 233 Cancel-Based Recovery 233 Other RMAN Recovery Topics 234 Read-Only Tablespace Recovery Considerations 234 Archived Redo Log Restores 234 Datafile Copy Restores 234 Recovering Corrupted Data Blocks 235 Recovering to a Previous Incarnation 235 Tablespace Point-In-Time Recovery 239 Performing Automated TSPITR 239 Manual TSPITR 241 TSPITR Restrictions 246 Verifying Your Backups are Recoverable 246 The restore preview Command 246 Restoring with the verify and check logical Commands 248 Using the validate backupset Command 249 Call the Movers! Cross-Platform Database Movement and RMAN 250 Introduction to Cross-Platform Transportable Tablespaces 250 Byte Ordering and Datafile Conversion 251 We Like to Move It! Move It! 251 Summary 252 Chapter 13: Surviving User Errors—Flashback Technologies 253 Prepared for the Inevitable: Flashback Technology 253 Flashback Query 253 Flashback and the Undo Segment: A Love Story 253 Performing Flashback Query 254 Flashback Version Query with Oracle Enterprise Manager 255 RMAN Workshop: Exploring Flashback Versions Query 255 Flashback Transaction Query 258 RMAN Workshop: Explore Flashback Transaction Query 259 Flashback Table 260 Performing the Flashback Table Operation from SQL 260 Flashback Table with Oracle Enterprise Manager 261 RMAN Workshop: Explore Flashback Table 261 Flashback Drop 262 The Recycle Bin 263 RMAN Workshop: Explore Flashback Drop and the Recycle Bin 264 Flashback Database 266 Flashback Logs 266 Flashback Retention Target 266 8 RMAN Workshop: Configure for Flashback Database 267 Flashback Database: Tuning and Tweaking 267 RMAN Workshop: Perform Flashback Database 268 Summary 269 Chapter 14: Maintaining RMAN 269 RMAN Maintenance 270 Cross-Checking RMAN Backups 270 RMAN Workshop: Using the crosscheck Command 272 Validation of RMAN Backups 272 Backup Retention Policies 273 The change Command 276 RMAN Workshop: Using the change Command 278 The delete Command 279 RMAN Workshop: Using the delete Command 280 Cataloging Other Backups in RMAN 280 Recovery Catalog Maintenance 281 Unregistering a Database in RMAN 281 Database Migration/Upgrade Issues 281 Manually Resetting the Database Incarnation (reset catalog) 282 Manually Resynchronizing the Recovery Catalog (resync catalog) 282 Purging Recovery Catalog Records 282 Recovery Catalog Schema Objects 283 Backing Up the Recovery Catalog 283 RMAN Stored Scripts 283 Creating Stored Scripts 283 Changing Stored Scripts 283 Deleting Stored Scripts 283 Using Stored Scripts 284 Printing Stored Scripts 284 RMAN Workshop: Using RMAN Stored Scripts 284 When You Just Can’t Take It Anymore 285 Summary 285 Chapter 15: Monitoring and Reporting on RMAN 285 The RMAN list Command 285 Listing Incarnations 285 Listing Backups 286 Listing Image Copies 294 The RMAN Report Command 296 Reporting on Datafiles That Have Not Been Backed Up Recently 296 Reporting on Backup Redundancy or Recovery Window 296 Reporting on Unrecoverable Operations on Datafiles 297 Reporting on the Database Schema 297 Reporting on Obsolete Backups 298 Summary 298 Chapter 16: Performance Tuning RMAN Backup and Recovery Operations 298 Before You Tune RMAN 299 RMAN Performance: What Can Be Achieved? 299 Have the Right Hardware in Place 299 Tune the Database 300 Tuning RMAN 302 Tuning RMAN Settings 303 Tune the MML Layer 305 Tuning Views You Can Use 305 9 V$SESSION_LONGOPS and V$SESSION 305 V$BACKUP_ASYNC_IO and V$BACKUP_SYNC_IO 306 Summary 308 Part IV: RMAN in the Oracle Ecosystem 308 Chapter List 308 Chapter 17: Duplication—Cloning the Target Database 308 RMAN Duplication: A Primer 308 Why Use RMAN Duplication? 309 The Duplication Architecture 309 Duplication: Location Considerations 314 Duplication to the Same Server: An Overview 314 Duplication to the Same Server, Different ORACLE_HOME 315 Duplication to a Remote Server: An Overview 315 Duplication and the Network 318 RMAN Workshop: Building a Password File 318 Duplication to the Same Server 320 RMAN Workshop: Duplication to the Same Server, Using Disk Backups 320 Using Tape Backups 322 Duplication to a Remote Server 323 RMAN Workshop: Duplication to a Remote Server, Using Disk Backups 323 Using Tape Backups for Remote Server Duplication 325 Incomplete Duplication: Using the DBNEWID Utility 325 Summary 326 Chapter 18: RMAN and Data Guard 326 Overview 326 RMAN and the Standby Database 327 Requirements for Using RMAN for Standby Database Creation 327 The duplicate…for standby Command 328 RMAN Workshop: Create a Standby Database Using RMAN 329 Taking Backups from the Standby Database 331 Datafile Backups from the Standby Database 332 Archive Log Backups from the Standby Database 333 Using Flashback Database for Standby Database Reinstantiation 333 Summary 333 Chapter 19: RMAN and Real Application Clusters 334 Overview 334 Real Application Clusters: Unique Backup Challenges 334 Datafile Backups 335 Archive Log Backups 336 RAC Recovery Challenges 338 Restore Operations 338 Media Management Considerations During a Restore 339 Recovery Considerations After a Restore 339 Advanced RMAN/RAC Topics 340 Duplication to a Single-Node System 340 RMAN Workshop: Duplicating a RAC Database to a Single-Node Database 340 The Single-Node Standby Database 342 RMAN Workshop: Creating a Single-Node Standby Database from a RAC Database 343 Backing Up the Multinode RAC Database 344 Summary 345 Chapter 20: RMAN in Sync and Split Technology 345 Sync and Split: Broken Mirror Backups 345 Oracle Databases on Sync and Split Volumes 347 10 Datafiles 348 Control Files 348 Redo Log Files 349 Archive Logs 349 Benefits of the Split Mirror Backup 349 Fast Point-In-Time Recovery 349 Speedy-Looking Backups 350 Mounting a Split Mirror Volume on Another Server 350 Taking Backups from the Split Mirror 350 RMAN and Sync and Split 350 Registering Split Mirror Copies with RMAN 350 Taking RMAN Backups from the Split Mirror 351 RMAN Workshop: Configure RMAN to Back Up from the Split Mirror 352 Getting Sync and Split Functionality on the Cheap 352 Using a Standby Database, Flashback Database, and Incremental Apply for Sync and Split352 Benefits of the Oracle Sync and Split Solution 354 Summary 354 Chapter 21: RMAN in the Workplace—Case Studies 354 Before the Recovery 354 What Is the Exact Nature of the Failure? 354 What Recovery Options Are Available? 355 Might Oracle Support Be Needed? 355 Who Else Can Act as a Second Pair of Eyes During Recovery? 355 Recovery Case Studies 356 Case #1: Recovering from Complete Database Loss (NOARCHIVELOG Mode) with a Recovery Catalog 356 Case #2: Recovering from Complete Database Loss (NOARCHIVELOG Mode) Without a Recovery Catalog 357 Case #3: Recovering from Complete Database Loss (ARCHIVELOG Mode) Without a Recovery Catalog 358 Case #4: Recovering from Complete Database Loss (ARCHIVELOG Mode) with a Recovery Catalog 360 Case #5: Recovering from the Loss of the SYSTEM Tablespace 362 Case #6: Recovering Online from the Loss of a Datafile or Tablespace 362 Case #7: Recovering from Loss of an Unarchived Online Redo Log 363 Case #8: Recovering Through resetlogs 364 Case #9: Completing a Failed Duplication Manually 365 Case #10: Using RMAN Duplication to Create a Historical Subset of the Target Database366 Case #11: Recovering from a Lost Datafile (ARCHIVELOG Mode) Using an Image Copy in the Flash Recovery Area 368 Case #12: Recovering from Running the Production Datafile Out of the Flash Recovery Area369 Case #13: Using Flashback Database and Media Recovery to Pinpoint the Exact Moment to Open the Database with resetlogs 371 Summary 372 Part V: Appendixes 372 Chapter List 372 Appendix A: RMAN Syntax Reference Guide 372 RMAN Reserved Words 372 RMAN Command List 374 RMAN Specifier and Operands Lists 374 RMAN Command List Syntax Details 375 @ and @@ Commands 375 allocate channel Command 375 [...]... 2: Introduction to the RMAN Architecture Chapter 1: Oracle Database 10g Backup and Recovery Architecture Tour Overview Welcome to Oracle Database 10g RMAN Backup & Recovery If you purchased our previous book, Oracle Database9 i RMAN Backup & Recovery, you have an idea of what to expect from this text However, this book is more than just a simple revision RMAN in Oracle Database 10g has so many new features... checkpoints Oracle Backup and Recovery Primer Before you use RMAN, you should understand some general backup and recovery concepts in Oracle Backups in Oracle come in two general categories, logical and physical In the following sections, we quickly look at logical backup and recovery and then give Oracle physical backup and recovery a full treatment Logical Backup and Recovery 29 Oracle Database 10g uses... using RMAN and are concerned that the changes in Oracle Database 10g will adversely affect your backup and recovery strategies, don’t worry RMAN is fully backward compatible, so your existing backup and recovery strategies will not have to change when you move to Oracle Database 10g If you are just starting with RMAN, then welcome aboard! RMAN is a great choice for Oracle database backup and recovery. .. offline backups, we will discuss the different Oracle recovery options available Finally, in these sections, we take a very quick, cursory look at Oracle manual backup and recovery NOARCHIVELOG Mode Physical Backups We have already discussed NOARCHIVELOG mode in the Oracle database This mode of database operations supports backups of the database only when the database is shut down Also, only full recovery. .. use RMAN successfully The book is designed to help you get started using RMAN as quickly as possible Before we get deep into RMAN, though, we thought you would like to take a tour of the base Oracle backup and recovery landscape, which actually has not changed a great deal in Oracle Database 10g The real changes are in RMAN, though there are a few new wrinkles here and there in Oracle Database 10g. .. Exploring the Recovery Catalog 417 Overview 417 RC_ARCHIVED_LOG (V$ARCHIVED_LOG) 418 RC _BACKUP_ CONTROLFILE (V $BACKUP_ DATAFILE) 418 RC _BACKUP_ CORRUPTION (V $BACKUP_ CORRUPTION) 418 RC _BACKUP_ DATAFILE (V $BACKUP_ DATAFILE) 419 RC _BACKUP_ FILES (V $BACKUP_ FILES) 419 RC _BACKUP_ PIECE (V $BACKUP_ PIECE) 419 RC _BACKUP_ REDOLOG (V $BACKUP_ REDOLOG)... uses the Oracle Data Pump architecture to support logical backup and recovery These utilities include the Data Pump Export program (expdp) and the Data Pump Import program (impdp) With logical backups, point-in-time recovery is not possible RMAN does not do logical backup and recovery, so this topic is beyond the scope of this book Oracle Physical Backup and Recovery Physical backups are what RMAN is... every copy of its flagship database software Oracle Recovery Manager, or RMAN for short As you probably already know, RMAN provides an interface for backing up and recovering your database But this book is about RMAN in Oracle 10g; this book is for RMAN in grid computing RMAN still provides the extremely useful features for those of you who need to take their backup and recovery strategies to the next... drives, RAID architectures, database clustering, database failover schemes, and, of course, backup and recovery HA adds additional costs to the overall database architectural solution, over and above the costs of the backup and recovery solution selected RMAN is really not an HA solution, but it is part of an overall database solution that can include HA Backup and recovery of your database is not superseded... incomplete recovery To perform full database recovery from a backup of a database in ARCHIVELOG mode, follow this procedure: 1 2 3 4 5 Restore all the database datafiles from your backup Restore all backed up archived redo logs Mount the database (startup mount) Recover the database (recover database) Oracle prompts you to apply redo from the archived redo logs Simply enter AUTO at the prompt and Oracle . the RMAN Architecture Chapter 1: Oracle Database 10g Backup and Recovery Architecture Tour Overview Welcome to Oracle Database 10g RMAN Backup &. the Database 25 Using the Database and Internals 27 Oracle Backup and Recovery Primer 29 Logical Backup and Recovery 29 Oracle Physical Backup and Recovery