- •About the Authors
- •Contents at a Glance
- •Contents
- •Table of Exercises
- •Introduction
- •Assessment Test
- •Answers to Assessment Test
- •What Is ASM?
- •Working with the ASM Instance
- •Overview of ASM Data Dictionary Views
- •Using ASM Storage
- •Using RMAN with ASM
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Understanding the Oracle Database as It Relates to Backup and Recovery
- •Performing Oracle Offline Backups
- •Performing Oracle Online Backups
- •Backing Up the Control File
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Performing Incomplete Recoveries
- •Performing Other Types of Recoveries
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Why Use RMAN?
- •Exploring the RMAN Architecture
- •Connecting to RMAN
- •Configuring RMAN for Use
- •Backing Up Your Database with RMAN
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Introducing the Recovery Catalog
- •Creating the Recovery Catalog User and Schema Objects
- •Using a Recovery Catalog
- •Maintaining the Recovery Catalog
- •Using the RMAN Virtual Private Catalog
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •RMAN Database-Recovery Basics
- •Using Image Copies to Recover Your Database
- •Other Basic Recovery Topics
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Switching Between RMAN Incarnations
- •Overview of RMAN Database Duplication
- •Performing an RMAN Tablespace Point-in-Time Recovery
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Overview of Flashback Technology
- •Using Automatic Undo Management
- •Using Flashback Technologies
- •Using Additional Flashback Operations
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Diagnosing the Database
- •Managing Database Performance
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Managing Memory
- •Managing Space
- •Managing Resources
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Automating Tasks with the Scheduler
- •Exploring the Scheduler Architecture
- •Exploring Common Administration Tools
- •Using Scheduler Jobs
- •Using Scheduler Programs
- •Using Schedules
- •Creating Lightweight Jobs
- •Using Job Chains
- •Using Scheduler Windows
- •Creating and Using Job Classes
- •Using Advanced Scheduler Concepts to Prioritize Jobs
- •Using Scheduler Views
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •An Overview of Globalization Support
- •Using NLS Parameters
- •Using Datetime Datatypes
- •Using Linguistic Sorts and Searches
- •Summary
- •Exam Essentials
- •Review Questions
- •Answers to Review Questions
- •Lab 1.1: Creating an ASM Instance
- •Lab 1.2: Creating ASM Disk Groups
- •Lab 1.3: Using ASM Disk Groups from a Database
- •Lab 2.2: Putting the Database in ARCHIVELOG Mode
- •Lab 2.3: Executing a Manual Online (Hot) Backup
- •Lab 3.1: Executing a Time-Based Point-in-Time Recovery
- •Lab 3.2: Recovering from Control-File Loss with a Backup Control File
- •Lab 3.3: Recovering from Loss of the Current Online Redo Log
- •Lab 4.1: Creating an RMAN Offline Backup
- •Lab 4.2: Creating an RMAN Incremental Backup
- •Lab 4.3: Creating an Image-Copy Backup
- •Lab 5.1: Implementing RVPC
- •Lab 6.1: Restoring a Datafile Online
- •Lab 6.2: Performing a Change-Based Recovery with RMAN
- •Lab 6.3: Restoring a Control File from an Autobackup
- •Lab 7.1: Monitoring RMAN Backups
- •Lab 7.2: One of My Backups Is Missing!
- •Lab 8.1: Duplicating a Database Using Active Database Duplication
- •Lab 8.2: Duplicating a Database Using Backup-Based Duplication to a Different Point in Time
- •Lab 9.1: Using the Recycle Bin
- •Lab 9.3: Using Flashback Data Archive
- •Lab 10.1: Using Support Workbench to Report a Problem to Oracle Support
- •Lab 11.1: Exporting a Transportable Tablespace
- •Lab 11.2: Testing Resumable Space Allocation
- •Lab 11.3: Manually Configuring the SGA
- •Lab 12.1: Creating a Local External Job
- •Lab 12.2: Creating a Job Window
- •Lab 13.1: Using the Locale Builder to Create a New Linguistic Sort
- •Lab 13.2: Setting NLS Parameters
- •Lab 13.3: Performing Linguistic Sorts
- •What You’ll Find on the CD
- •System Requirements
- •Using the CD
- •Troubleshooting
- •Glossary
- •Index
Maintaining the Recovery Catalog |
219 |
The RMAN executable includes the using command-line parameter that allows you to define the value of the substitution variable. For example, if the previous restore command were in a file called restore.cmd and you wanted to restore a backup with the tag MINE, you would call RMAN in this manner:
Rman target=/ @restore.cmd using MINE
You can also use substitution variables with stored scripts. For example, you can create a script to back up your database and use a tag as shown here:
RMAN> create script db_backup_script
2> { backup database tag ‘&1’ plus archivelog delete input;} Enter value for 1: test
created script db_backup_script
You can then execute the script, setting the variable with the using command, as shown here:
RMAN> Run {execute script db_backup_script using ‘TEST’;}
Maintaining the Recovery Catalog
If you are running the recovery catalog, you will need to know how to synchronize it with the control file of the database. Additionally, you will need to back up the recovery catalog. We briefly cover these two topics next.
Synchronizing the Recovery Catalog
Typically during an RMAN operation, the recovery catalog will be synchronized with the control file. New records will be updated or added during this synchronization process. There may be times you will want to synchronize the recovery catalog yourself manually. You can use the resync catalog command to perform manual catalog synchronization. Here is an example of using the resync command:
RMAN> resync catalog;
starting full resync of recovery catalog full resync complete
Backing Up the Recovery Catalog
You can actually back up the recovery catalog using RMAN. You would simply use the control file of the recovery catalog to store the backup-related information. You can do online or offline backups and complete or point-in-time restores as your needs dictate.
220 Chapter 5 n Using the RMAN Recovery Catalog
You can also use Oracle’s flashback features (see Chapter 9 for more on Oracle Flashback Database) on the recovery catalog.
Why Resync the Catalog?
You might be asking yourself, “If RMAN resynchronizes the catalog automatically after a backup, why would I ever need to use the resync catalog command?” That’s a fair question.
One place where one of us was employed had a large number of databases and used RMAN and the recovery catalog. As more and more records were added to the recovery catalog, we found our backups were taking longer. This ended up being because of a bug in RMAN. To work around the problem until Oracle could give us a fix, we did our backups without connecting to the recovery catalog. These made the backups perform much faster. We would then connect to the recovery catalog in a different operation and resync the control file to the recovery catalog.
This corrected the performance problem while still allowing us to use the recovery catalog to store our database backup metadata.
Using the RMAN Virtual Private Catalog
You might have noticed that the catalog-schema owner has access to all data in the recovery catalog. You may want to allow other users access to the recovery catalog, but you may want them to see information on only specific databases. Oracle provides the RMAN virtual private catalog for just such cases. In the following sections, we will discuss how to create a virtual catalog and how to grant users access to databases contained within it. We will discuss how to create the RMAN virtual private catalog first, and then we will discuss administration of the virtual private catalog.
Creating the RMAN Virtual Private Catalog
If you want to use the RMAN virtual private catalog (RVPC), you start with a regular recovery catalog. The recovery-catalog schema should have been created and the databases registered (you can, of course, register databases later), and it can be brand-new or already have been in use.
Using the RMAN Virtual Private Catalog |
221 |
Now that you have a recovery catalog, let’s assume you have registered two databases in the recovery catalog; one is called orcl and one is called secret. Let’s assume you have a DBA named Ed who you don’t quite trust (he’s a seedy-looking guy with tattoos of the Smurfs all over his arms). Because you don’t trust him, you want him to be able to access
only the orcl database RMAN records. The secret database records will remain a mystery to him (you assume, of course, that he does not have SYS access to your recovery catalog, or all is lost!).
To create the RVPC account for Ed, you would execute the following steps:
Step 1: Create the RVPC database account. First you create the RVPC database account log in the recovery-catalog database as a privileged user (for example, SYS) and issue the create user command. You will also need to grant the recovery_catalog_owner privilege to the new user.
Step 2: Create the RVPC. Once the RVPC user has been created, you need to create the virtual catalog. To do this, you log into RMAN and use the create virtual catalog command, as shown here:
Create virtual catalog;
Step 3: Grant the RVPC access to the appropriate catalog databases. Now that you have created the RVPC account, you need to indicate to the recovery-catalog database which databases this account will have access to. You will use the RMAN command to perform this operation as shown here, where we grant access to the ORCL database catalog metadata:
grant catalog for database orcl to rcat_001;
Administering the RMAN Virtual Private Catalog
Once you have set up RVPC, there are other administrative activities you can perform. For example, you can grant the register database privilege to RVPC owners using the RMAN grant command as shown here:
RMAN> grant register database to rcat_002;
Grant succeeded.
The revoke RMAN command is used to revoke privileges to databases in the RVPC or other privileges, such as the register database privilege, as shown here:
RMAN>Revoke catalog for database abcs;
RMAN>Revoke register database from rcat_002;
222 Chapter 5 n Using the RMAN Recovery Catalog
Finally, you can drop the RVPC with the drop catalog command as shown in this example:
RMAN>connect catalog rcat_002/rcat002@rcat;
RMAN> drop catalog;
After using the drop catalog command, it’s safe to drop the RVPC catalog user with the drop user SQL command:
SQL> drop user rcat_001;
Summary
The recovery catalog is an optional but very powerful tool in your RMAN arsenal. It can make your life as a DBA easier by providing a centralized repository for all your RMANrelated data. The recovery catalog is easy to create and maintain. Oracle’s new virtual private catalog features make the recovery catalog even more powerful, increasing the security within the catalog.
Exam Essentials
Identify situations that will require the RMAN recovery catalog. Understand that the recovery catalog is largely optional. A recovery catalog will be needed for storing scripts, and it will be required if you want to store backup records longer than one year or beyond the setting of CONTROL_FILE_RECORD_KEEP_TIME.
Create and configure an RMAN recovery catalog. Understand the process required to create the RMAN recovery catalog. Know how to create the recovery-catalog user and what privileges are required. Understand how to register and unregister databases with the recovery catalog and how to create a virtual private catalog and configure users to use it.
Maintain the RMAN recovery catalog. Understand how to back up the recovery catalog. Know how to synchronize the target database with the recovery catalog.