Professional Documents
Culture Documents
RECOVERY CATALOG
RMAN utility mainly used for Backup and Recovery operations for an Oracle Database.
RMAN stores metadata (RMAN Repository) of its operations (backup/restore/recovery) typically in
the control file of the target database and optionally in Recovery Catalog Schema of the separate
Oracle database, if Catalog is configured. A Recovery Catalog is a Schema that tracks backups and
stores scripts in a separate database, which is useful to RMAN for Backup and Recovery situations.
RMAN REPOSITORY
The RMAN repository is the collection of metadata I.e. (the record of RMAN metadata about backup
and recovery operations) on the target database that RMAN uses for backup, recovery, and
maintenance. RMAN stores this information in the control file. The backup information can be
retrieve either using LIST, REPORT and SHOW commands from RMAN prompt or using SQL queries from
views of the catalog Schema.
A separate database contains special schema i.e. (Recovery Catalog Schema) that the schema
contains multiple objects to store backup, restore and recovery info of the target database.
In no catalog mode, RMAN keeps the backup info in the reusable section of target database of the
control file. If the target database control files are lost recovery can become tedious job for
DBA’s. To avoid this situation Oracle has introduced Recovery Catalog.
As we know a Recovery Catalog is a database Schema used by RMAN to store RMAN metadata about one
or more Oracle databases. It creates redundancy for the RMAN repository stored in the control file
of each target database. Here Recovery catalog servers as a secondary metadata repository. If
target control files are lost, then the RMAN metadata still exists in the Recovery Catalog.
More over the Recovery Catalog can store metadata history much longer (many years of backup history)
than the control file. This is useful when we perform recovery that goes back in time than the
history in the target database control file.
A Recovery Catalog is required when you use RMAN in Data Guard environment. Only the Primary
database is explicitly registered to the RMAN Catalog; and Physical Standby databases are registered
automatically if they are connected as target while connected to the Recovery Catalog. Here RMAN
uses db_unique_name parameter to identify one database from another.
Some RMAN features function only when we use Recovery catalog. It’s possible to store RMAN Scripts
in a Recovery Catalog. The advantage is Stored Scripts are, available to any RMAN Client that can
connect to the target database and Recovery Catalog.
STORED SCRIPT
A sequence of RMAN commands stored in the Recovery Catalog. We can use a Stored Scripts as an
alternative to a command file for managing frequently used sequence of RMAN commands. The command
create script is a RMAN command which is used to create Stored Scripts in Recovery Catalog.
As we know the Recovery Catalog contains metadata about RMAN operations for registered target
database. When RAMN is connected to a Recovery Catalog, RMAN obtains its metadata exclusively from
the Catalog. The Catalog contains RMAN operations and following type of metadata including:
Stored Scripts
RMAN configuration settings.
Database Structure (tablespaces and data files)
Backup sets and Backup pieces of data files and Archived Redo Log files.
Image copies of data files and archived Redo Logs
DATABASE REGISTRATION
Even we specify bigger values for the parameter retention may NOT be guaranteed because control
file grows up to Operating System beyond that is overwrites the existing backup information. So
it is highly recommend to configure Recovery Catalog for Critical Production databases.
ON TARGET DATABASE
CATALOG DATABASE
Connect to RMAN prompt and execute create catalog to create RMAN metadata tables.
Connect to Target database through Catalog database and register the target database.
**
SYSTEM ENVIRONMENT
Tablespace created.
Creating a dedicated user which will be the owner of the Recovery Catalog.
User created.
The role recovery_catalog_owner has some privileges to query and maintain the Recovery Catalog.
PRIVILEGE
----------------------------------------
CREATE SYNONYM
CREATE CLUSTER
ALTER SESSION
CREATE DATABASE LINK
CREATE PROCEDURE
CREATE SEQUENCE
CREATE TABLE
CREATE SESSION
CREATE TYPE
CREATE VIEW
CREATE TRIGGER
11 rows selected.
The actual process of the Recovery Catalog is performed in RMAN. The command CREATE CATALOG
creates the catalog in the default table space of the user.
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Now connect as rmanuser and check all objects are created or not
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora
PRODDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.117.131)(PORT=1521))
(CONNECT_DATA =
(SERVER=DEDICATED)
(SERVICE_NAME=prod)
)
)
$ cd $ORACLE_HOME/network/admin
$ vi listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME=prod)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(GLOBAL_DBNAME=prod)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.241.131)(PORT=1521))
)
)
$ tnsping PRODDB
..
...
$ cd $ORACLE_HOME/dbs
$ export ORACLE_SID=prod
[oracle@SERVER1 dbs]$ orapwd file=orapwprod password=dba entries=3 force=y
[oracle@SERVER1 dbs]$ ls orapw*
orapwprod
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
===========================
4 5 USERS NO /u01/app/oracle/oradata/prod/users01.dbf
You can use the following command to verify registered databases on the recovery catalog
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
83 PROD 318150854 PRIMARY PROD
$ rlsqlplus rmanuser/rmanuser
Connected to:
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
$ vi rman.log
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/rmanbkp/%F.ctl'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE; #default
..
...
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
..
...
[Trimmed]
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u03/rmanbkp/snapcf_prod.f';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
NAME
----------------------------------------------
/u01/app/oracle/oradata/prod/system01.dbf
/u01/app/oracle/oradata/prod/sysaux01.dbf
/u01/app/oracle/oradata/prod/undotbs01.dbf
/u01/app/oracle/oradata/prod/users01.dbf
/u01/app/oracle/oradata/prod/example01.dbf
$ cd /u01/app/oracle/oradata/prod
$ mv *.dbf /u03/bkp
database mounted
released channel: ORA_DISK_1
# RESTORE DATABASE
# RECOVER DATABASE
...
$ cd /u0/app/oracle/oradata/prod
$ mv *.* /u03/bkp/
$ cd /u0/app/oracle/flash_recovery_area/prod
$ mv *.ctl /u03/bkp
$ rlrman target /
..
...
connected to target database (not started)
..
...
connected to target database: PROD (not mounted)
connected to recovery catalog database
database mounted
released channel: ORA_DISK_1
database opened
STORED SCRIPTS
The command create script is used to create stored scripts in Recovery Catalaog.
Stored scripts can be two types
Global Stored Scripts can be executed for all databases which are registered in the recovery
catalog. Local Stored Scripts is associated with target database to which RMAN is connected when
the script is created; and can be executed when you are connected to the target database.
..
...
connected to target database: PROD (DBID=318631334)
connected to recovery catalog database
RMAN> run
{execute script full_bkp;}
# DELETING SCRIPTS
..
...
connected to target database: DEVDB (DBID=811474030)
connected to recovery catalog database
Remark: To unregister a database from the recovery catalog, use UNREGISTER DATABASE;
Do you really want to unregister the database (enter YES or NO)? YES
database unregistered from the recovery catalog
RMAN Recovery Catalog consolidate backup metadata of multiple target databases. The Recovery
Catalog owner can manage and maintain all metadata of these target databases in a repository.
Several RMAN metadata of all registered databases are stored in the same repository. In large
database environments more than one DBA is managing the same repository.
Any user has access privilege to a Recovery catalog, that user could view data from all the
databases registered in the recovery catalog. All users of an RMAN Recovery Catalog have full
privileges to insert, update, and delete any metadata in the Recovery Catalog. There was no way
to provide partial access to the Recovery Catalog before 11g.
This methods allows Recovery Catalog owner to create Virtual Catalogs for each database. Using
this feature we can grant restricted access on RMAN Catalog to some users, so that they can only
access a limited number of databases that are registered with RAMN Catalog.
Now there is a logical boundary between each catalog for different databases; because administrators
of the different database can virtually connect their own Catalog but they will not able to see
metadata of other databases thus enhancing security by restricting access to others metadata. Each
restricted user has full read/write access to his own Virtual Private Catalog.
The entire Recovery Catalog can be a Base Recovery catalog. A VPC is a set of synonyms and views
that refers to a Base Recovery Catalog. It’s possible to create one or more Virtual Private Catalog;
the mechanism for Virtual Private Catalog exist in the Recovery Catalog Schema itself. The VPC
owner can create a local stored script, but only has read-only access to a global stored script.
NETWORK CONNECTIVITY
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
CATDB
--------------
DB SERVER3 192.168.117.132
-------------
RECOVRY CATALOG DATABASE - CATDB
-----
SYSTEM INFORMATION
In this scenario, there are 3 databases namely devdb, orcl and prod. Already prod database has
been registered with Recovery Catalog owned by the user RMANUSER.
Tablespace created.
User created.
User created.
SYS> select username, default_tablespace from dba_users where username like 'VPC%';
USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
VPC_ORCL VPCTBS
VPC_DEV VPCTBS
Need to add an entry for devdb for databases in listener.ora file on DEBSERVER1
Need to add an entry for orcl for databases in listener.ora file on DEBSERVER2
Need to add an entry for devdb and orcl databases in tnsnames.ora file on DBSERVER3
DEVDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.117.130)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = devdb)
)
)
ORCLDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.117.131)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.117.130)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.117.131)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = devdb)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
)
(SID_DESC =
(SID_NAME = prod)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
)
)
Now register the devdb database to the Recovery Catalog using Recovery Catalog owner (rmanuser)
on DBSERVER3 – (192.168.117.132)
..
...
Now we need to register the orcl database to the Recovery Catalog using Recovery Catalog owner
(rmanuser) on DBSERVER3 – (192.168.117.132)
..
...
Now we need to grant privileges to (vpc_orcl and vpc_dev) users to access RMAN metadata stored on
CATDB from rmanuser.
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> exit
COUNT(*)
----------
101
COUNT(*)
----------
101
If we connect as the original RMAN catalog owner (rmanuser) we can see all the registered databases
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
462 PROD 318631334 PRIMARY PROD
1806 DEVDB 811474030 PRIMARY DEVDB
2062 ORCL 1434957320 PRIMARY ORCL