Backup Recovery   «Prev  Next»

Lesson 3Recovery catalog
ObjectiveCreate a recovery catalog.

Oracle Recovery Catalog

To create an Oracle Recovery Catalog in Oracle 13c, follow these steps:
  1. Create a user and schema for the Recovery Catalog. For example:
    CREATE USER rman IDENTIFIED BY password TEMPORARY TABLESPACE temp DEFAULT TABLESPACE tools QUOTA UNLIMITED ON tools;
    GRANT RECOVERY_CATALOG_OWNER TO rman;
    
  2. Create the Recovery Catalog database. This database must be created using the Enterprise Edition of Oracle Database.
    CREATE DATABASE rcatdb AS SELECT * FROM catdb;
    
  3. Start RMAN and connect to the Recovery Catalog database as the Recovery Catalog owner.
    RMAN> CONNECT CATALOG rman@rcatdb;
    
  4. Create the Recovery Catalog tables.
    RMAN> CREATE CATALOG;
    
  5. Register the target databases with the Recovery Catalog.
    RMAN> REGISTER DATABASE target_database;
    
  6. Verify that the Recovery Catalog is created and that the target databases are registered.
    RMAN> LIST CATALOG;
    

This will list the Recovery Catalog database and all of the target databases that are registered with it. Once the Recovery Catalog is created and the target databases are registered, you can start using RMAN to back up and recover your databases. Here are some additional tips for creating and using the Recovery Catalog:
  • The Recovery Catalog database should be located on a separate server than the target databases. This will help to protect the Recovery Catalog from failure of the target database servers.
  • The Recovery Catalog database should be backed up regularly. This will ensure that you can recover the Recovery Catalog if it fails.
  • You can use RMAN to monitor the Recovery Catalog and to generate reports on the status of the Recovery Catalog and the target databases.

For more information on creating and using the Recovery Catalog, please refer to the Oracle Database Backup and Recovery User's Guide.

Recovery Manager Theory

Recovery Manager maintains a repository called the recovery catalog, which contains information about 1) backup files and 2) archived log files. RMAN uses the information within the recovery catalog, which is obtained from the control file, to determine how to execute the requested backup and recovery operations. The recovery catalog contains:
  1. Information on backups of datafiles and archive logs
  2. Information on datafile copies
  3. Information on archived redo logs and copies of them
  4. Information on the physical schema of the target database
  5. Stored scripts, which are named user-created sequences of RMAN and SQL commands

Snapshot Control File

The recovery catalog obtains crucial RMAN metadata from the target database control file. This metadata must be kept up-to-date; hence, RMAN must synchronize with the control file of the target data frequently. RMAN generates a snapshot control file, which is a temporary backup control file, each time it resynchronizes. This snapshot control file ensures that RMAN has a consistent view of the control file either when refreshing the recovery catalog or when querying the control file.
Oracle Shared Server does not guarantee that only one RMAN session accesses a snapshot control file at any point in time.
The Oracle Shared Server is a process that manages multiple database sessions on a single server process. It does this by sharing the resources of the server process among the multiple sessions. This can improve performance and scalability for database applications.
Warning: The Shared Server does not provide any special handling for snapshot control files. This means that multiple RMAN sessions can access the same snapshot control file at the same time. This can lead to problems if the RMAN sessions are trying to update the snapshot control file at the same time.
For example, if one RMAN session is trying to back up the control file and another RMAN session is trying to restore the control file, this could cause data corruption. To avoid these problems, it is important to coordinate access to the snapshot control file when using RMAN with the Shared Server. You can do this by using a locking mechanism, such as a semaphore[1].
Here is an example of how to use a semaphore to coordinate access to the snapshot control file:
-- Create a semaphore to lock the snapshot control file.
CREATE SEMAPHORE snapshot_control_file_lock;

-- Acquire the semaphore before accessing the snapshot control file.
ACQUIRE snapshot_control_file_lock;

-- Access the snapshot control file here.

-- Release the semaphore after accessing the snapshot control file.
RELEASE snapshot_control_file_lock;

By using a semaphore to coordinate access to the snapshot control file, you can ensure that only one RMAN session accesses the snapshot control file at any point in time. This will help to prevent data corruption. Oracle recommends that you use a locking mechanism to coordinate access to the snapshot control file when using RMAN with the Shared Server.
If the recovery catalog is destroyed and its backup is not available, you can partially reconstruct the catalog from the current control file or control file backups. But, you should always aim to have a valid, recent backup of your recovery catalog.

Setting up the Recovery Catalog Schema

To set up the recovery catalog schema:
  1. Start SQL*Plus and connect with administrator privileges to the database containing the recovery catalog.
  2. Create a log file that you can use to check for errors.
  3. Create a user and schema for the recovery catalog.
  4. Grant the RECOVERY_CATALOG_OWNER role to the schema owner. This role provides the user with privileges to maintain and query the recovery catalog.
  5. Grant other desired privileges to the RMAN user.
  6. Check the log file for any errors before continuing.
To create the recovery catalog:
  1. Connect to the recovery catalog from the operating system command line.
  2. Issue the CREATE CATALOG command to create the catalog.
  3. Check the log file for any errors.

Deploying the recovery catalog

Here are some recommendations for deploying the recovery catalog:
  1. It should be a separate database, not contained within any of the target databases whose backup data it contains.
  2. Use RMAN to back up the Recovery Catalog database. However, for these backups, start RMAN with the NOCATALOG option, so that the backup repository for the Recovery Catalog is its own control file.
  3. After each backup of the Recovery Catalog, use manual (NOT RMAN!) procedures to back up the Recovery Catalog control file, so that you can restore it if you ever need to restore the Recovery Catalog.

The catalog’s availability can be set through one of the following techniques: standby database or replication. You can maintain two separate Recovery Catalog databases: one is automatically synchronized because it is used for everyday production operations, and the other is kept in sync manually, by periodically issuing the RESYNC CATALOG command.
For the purpose of the examples within this module, the recovery catalog is maintained within a separate database. BACKUP is the name of the catalog database, where the user id/password for the RMAN user is RMAN/RMAN. The target database, which is to be backed up, is called PETS. The user id/password to the database is RMAN/RMAN. Note that the examples illustrated within this module are written for Oracle8i (8.1.5) Enterprise Edition for Microsoft Windows.

Creating Oracle Recovery Catalog (Legacy)

The correct steps for creating the catalog are as follows:
  1. Log into SQL*Plus, create a user ‘rman’, and assign RECOVERY_CATALOG_OWNER to this user.
  2. Log into RMAN by using the user created into ‘greatpets’ database.
  3. To create the recovery catalog, issue the CREATE CATALOG command.

Oracle Backup and Recovery

RMAN can be used with or without a recovery catalog.
A recovery catalog is a schema stored in a database that tracks backups and stores scripts for use during the RMAN backup and recovery situations.
An experienced DBA would suggest that the Enterprise Manager instance schema and RMAN catalog schema be placed in the same utility database on a server separate from the main servers. The RMAN schema generally only requires 16 megabyte per year for each database backed up.

The next lesson shows how to create a backup script.
[1] semaphore: A semaphore, in the context of Oracle locking mechanisms, is a programming construct that allows multiple threads to synchronize their access to a shared resource. Semaphores are used in Oracle to implement a variety of locking mechanisms