By default, RMAN stores its repository in the control file during backups. How long this information is kept, is controlled by the parameter CONTROL_FILE_RECORD_KEEP_TIME. This parameter has a range from 0 to 365 (days). The default value for this parameter is 7 (days).
The recovery catalog database to be used, should be different from the target database.
The difference between using the control file and a recovery catalog database are outlined below:
Control File | Recovery Catalog Database |
Stores RMAN repository for the local database only | Stores RMAN repository for multiple target databases |
RMAN repository information can be stored for maximum of one year | RMAN repository information can be stored for longer period |
In-terms of management, this is easier | It is more complicated to manage. You have to backup and manage this database as well. |
You cannot use the KEEP FOREVER clause of the RMAN BACKUP command | You can use the KEEP FOREVER clause of the RMAN BACKUP command |
History of the target database physical structure cannot be retrieved | History of the target database physical structure can be retrieved |
The control file cannot be used to store RMAN backup scripts | RMAN backup scripts can be stored in it. |
To take advantage of the benefits the Recovery Catalog have over the Control File in storing RMAN repository, we configure one in this post.
On planning the size of the recovery catalog schema, kindly refer to this link : https://docs.oracle.com/en/database/oracle/oracle-database/19/bradv/managing-recovery-catalog.html#GUID-FC223E07-1298-42AC-8D07-36D2BB893B10
We will follow three steps to create the Recovery Catalog:
- Configure the Recovery Catalog Database
- Create the Recovery Catalog owner
- Create the Recovery Catalog
Configure the Recovery Catalog Database
Setup or use a database different from the target database to be registered in the Recovery Catalog. Create a tablespace for the recovery catalog. This will be the default tablespace for the recovery catalog owner.
SQL> sqlplus system/xxxxxx@ORADB
SQL> create tablespace rc_tbs datafile '/u01/app/oracle/oradata/ORADB/rc_tbs_01.dbf' size 1024M autoextend on next 100M maxsize 10G;
Tablespace created.
SQL>
Create the Recovery Catalog owner and assign the created tablespace as the default.
In this example we will use, ‘rcuser’. Replace ‘xxxxx ‘ with the schema password.
SQL> CREATE USER rcuser IDENTIFIED BY xxxxx TEMPORARY TABLESPACE temp DEFAULT TABLESPACE rc_tbs QUOTA UNLIMITED ON rc_tbs;
User created.
Grant the RECOVERY_CATALOG_OWNER role to owner.
SQL> GRANT RECOVERY_CATALOG_OWNER TO rcuser ;
Grant succeeded.
Create the Recovery Catalog
Connect to the database that contains the catalog owner ‘rcuser’ and Create the Catalog.
$ rman
RMAN> CONNECT CATALOG rcuser/xxxxx@ORADB
connected to recovery catalog database
RMAN> CREATE CATALOG;
recovery catalog created
RMAN>
Register a Target Database
Databases to be backed up must be registered in the Recovery Catalog. In a dataguard environment, only the Primary database must be registered. Connect to the Target database server and make an entry in the tnsnames.ora file. Make the following entries in the tnsnames.ora file.
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora
RMANCATDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = put_your_catalog_db_hostname )(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORADB)
)
)
Test the connection
$ tnsping RMANCATDB
Once the connection is successful, invoke RMAN. Connect to the local database as target and connect to the recovery catalog (ORADB) using the tnsname.ora entry.
$ rman target "'/ as SYSBACKUP'"
RMAN> connect CATALOG rcuser/xxxxx@RMANCATDB
connected to recovery catalog database
RMAN> REGISTER DATABASE;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
On the Recovery Catalog database login to sqlplus to check registered databases.
$ sqlplus rcuser/xxxxxx
SQL> select DBID,NAME from RC_DATABASE;
DBID NAME
---------- --------
402495632 PRODDB1
SQL>