Recovery catalog allows to store database metadata in a dedicated database schema. It can have longer renteion for backup records than storing them in control file. If data guard is used a recovery catalog is needed to easily interchange backups between standby and primary. This post gives few highlights of using recovery catalog.
Creating Recovery Catalog
Registering Database in Recovery Catalog
Sync Changes to Catalog
Unregistering a Database From Recovery Catalog
Dropping the Recovery Catalog
Creating Recovery Catalog
To be useful recovery catalog must reside external to the database registered within. Usually on a dedicated DB server and Oracle provides restricted special usage license to be used with databases used purely for recovery catalog.
It's adivsed to use a dedicated tablespace for recovery catalog schema user. In this post following tablespace is used.
To register a database in recovery catalog connect to the target database and the recovery catalog at the same time.
Whenever changes are made to DB while disconnected from recovery catalog, those changes are sync to recovery catalog with an implicit sync job. This happpens when next time target DB is connected to the recovery catalog and a command is run (not necessarily a sync comamnd). For exmaple the retention is changed while disconnected from recovery catalog.
Unregistering a Database From Recovery Catalog
To unregister a database from recovery catalog invoke unregister command with the db_name or db_unique_name (in the case of standby instances)
Dropping the Recovery Catalog
To drop the catalog connect to target and recovery catalog as recovery catalog owner and run the drop catalog command twice.
Creating Recovery Catalog
Registering Database in Recovery Catalog
Sync Changes to Catalog
Unregistering a Database From Recovery Catalog
Dropping the Recovery Catalog
Creating Recovery Catalog
To be useful recovery catalog must reside external to the database registered within. Usually on a dedicated DB server and Oracle provides restricted special usage license to be used with databases used purely for recovery catalog.
It's adivsed to use a dedicated tablespace for recovery catalog schema user. In this post following tablespace is used.
SQL> create tablespace recocattbs datafile size 50m autoextend on next 50m maxsize unlimited;The recovery catalog schema user could be created in a pdb or non-cdb.
Tablespace created.
create user recocat identified by CAT_#123reco default tablespace recocattbs temporary tablespace temp quota unlimited on recocattbs;The recovery catalog user need following role to create the catalog.
GRANT RECOVERY_CATALOG_OWNER TO recocat;However, this role alone isn't enough to prevent the following error.
RMAN> create catalog;To resolve this add the following (refer 1086561.1)
error creating dbms_rcvcat package body
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06433: error installing recovery catalog
grant SELECT ON USER_DB_LINKS to recocat;If as part of DB security hardening (CIS standard) if certain execution rights were revoked from public then grant those privileges to recovery catalog user. Below is the required list for recovery catalog.
grant execute on utl_http to recocat;With the role and privileges granted connect to the recovery catalog using rman and create the catalog.
grant execute on dbms_lob to recocat;
grant execute on dbms_xmlgen to recocat;
grant execute on dbms_sql to recocat;
rman catalog recocat/CAT_#123recoRegistering Database in Recovery Catalog
RMAN> create catalog;
recovery catalog created
To register a database in recovery catalog connect to the target database and the recovery catalog at the same time.
rman target / catalog recocat/CAT_#123reco@devpdb. Once connected run register database command. First time this is run an implicit resync happens. Depending on amount of records kept in controlfile, netwrok bandwidth between target DB and recovery catalog DB server this could take some time.
Recovery Manager: Release 19.0.0.0.0 - Production on Mon Aug 24 17:30:37 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: DEVCDB (DBID=2653754887)
connected to recovery catalog database
RMAN> register database;Once registered with recovery catalog all the database registered could be viewed with following.
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> list db_unique_name all;Sync Changes to Catalog
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
1 DEVCDB 2653754887 PRIMARY DEVCDB
608 XGENLT 4291278017 PRIMARY XGENLT
Whenever changes are made to DB while disconnected from recovery catalog, those changes are sync to recovery catalog with an implicit sync job. This happpens when next time target DB is connected to the recovery catalog and a command is run (not necessarily a sync comamnd). For exmaple the retention is changed while disconnected from recovery catalog.
rman target /When next time connected to recvoery catalog an implicit resync happens when a command (this case show command) is run.
Recovery Manager: Release 19.0.0.0.0 - Production on Mon Aug 24 17:32:49 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: DEVCDB (DBID=2653754887)
RMAN> CONFIGURE RETENTION POLICY TO recovery window of 1 days;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
new RMAN configuration parameters are successfully stored
rman target / catalog recocat/CAT_#123reco@devpdbIf an explicity resync is needed then run the following.
Recovery Manager: Release 19.0.0.0.0 - Production on Mon Aug 24 17:35:43 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: DEVCDB (DBID=2653754887)
connected to recovery catalog database
RMAN> show all for db_unique_name devcdb;
starting full resync of recovery catalog
full resync complete
RMAN configuration parameters for database with db_unique_name DEVCDB are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
RMAN> resync catalog;
starting resync of recovery catalog
resync complete
Unregistering a Database From Recovery Catalog
To unregister a database from recovery catalog invoke unregister command with the db_name or db_unique_name (in the case of standby instances)
RMAN> unregister database xgenlt;Oracle documentation mentions an option to unregister with backups. But invoking this results in an error.
database name is "XGENLT" and DBID is 4291278017
Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog
RMAN> list db_unique_name all;
List of Databases
DB Key DB Name DB ID Database Role Db_unique_name
------- ------- ----------------- --------------- ------------------
1 DEVCDB 2653754887 PRIMARY DEVCDB
RMAN> unregister db_unique_name PPCBXDB5 including backups;This is mentioned as bug 5308590.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of unregister db & bck command at 09/03/2020 19:15:34
RMAN-06014: command not implemented yet: unregister db & bck
Dropping the Recovery Catalog
To drop the catalog connect to target and recovery catalog as recovery catalog owner and run the drop catalog command twice.
rman target / catalog recocat/CAT_#123reco@devpdb
RMAN> drop catalog;
recovery catalog owner is RECOCAT
enter DROP CATALOG command again to confirm catalog removal
RMAN> drop catalog ;
recovery catalog dropped