All technological notes.
The RMAN repository data is
control file of the target database.recovery catalog.recovery catalog

RMAN propagates information about target database into the recovery catalog from the target database’s control file after any operation that updates the repository and also before certain operations, including:
database structure,archived redo logs,backup sets,data file copies是 RMAN 更新目标信息; 从 cf 提取; 时机:任何更新之后; 文件: 结构, log, bs, copy
Prerequisites: 前设:同时连接两个实例
target database instancecatalog database instanceBenefits
control file
CF has finite space for records of backup activities.recovery catalog is able to store information for multiple target databases. 一对多Enterprise Manager Cloud Control also enables you to view backup information for multiple databases without the use of a recovery catalog.KEEP FOREVER clause of the BACKUP command
KEEP FOREVER clause can create a backup that is retained for a different period of time from that specified by the configured retention policy.data files and tablespaces that are or were in the target database at a given time
REPORT SCHEMA command lists the tablespaces and data files in the target database.AT [time |scn|logseq], you can see the information at some time in the past.AT option only if you are using a recovery catalog.control file because it preserves RMAN repository metadataDisadvantage of recovery catalog
Control File vs CatalogControl File:
recovery catalog:
control file dataTo create a recovery catalog, perform the following three steps:

Allocate space for the recovery catalog.
archived redo log files and backups recorded
Create a tablespace for the recovery catalog, which will be designated as the default tablespace for the recovery catalog owner.
-- request 15 MB for each database registered in the recovery catalog.
CREATE TABLESPACE rcat_ts DATAFILE <data file name> SIZE 15M;
tablespace for this user to the tablespace you created for the recovery catalog.UNLIMITED quota on this tablespace for the user.RECOVERY_CATALOG_OWNER role.
RECOVERY_CATALOG_OWNER role:
CREATE SESSIONALTER SESSIONCREATE CLUSTERCREATE DATABASE LINKCREATE PROCEDURECREATE SEQUENCECREATE SYNONYMCREATE TRIGGERCREATE TYPECREATE TABLECREATE VIEWCREATE USER rcowner IDENTIFIED BY rcpass
TEMPORARY TABLESPACE temp
DEFAULT TABLESPACE rcat_ts
QUOTA UNLIMITED ON rcat_ts;
GRANT recovery_catalog_owner TO rcowner;
CREATE CATALOG command to create the catalog tables in the default tablespace of the catalog owner.Note: As with any database, if the ORACLE_SID environment variable is set to the SID for the recovery catalog database, there is no need to supply the service name in the CONNECT statement.
-- Connect to the recovery catalog database as the catalog owner:
-- rman
CONNECT CATALOG username/password@net_service_name
-- Execute the CREATE CATALOG command:
CREATE CATALOG;
-- create a pdb as a rcat
CREATE PLUGGABLE DATABASE rcat
ADMIN USER rcatadmin IDENTIFIED BY welcome
ROLES = (dba)
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/ORCL/RCAT/users01.dbf'
SIZE 250M
AUTOEXTEND ON
FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/ORCL/pdbseed/',
'/u01/app/oracle/oradata/ORCL/RCAT/');
-- update tnsname
-- Connect to rcat
CONNECT sys@rcat as sysdba;
-- Create default tbsp for rcat
CREATE TABLESPACE rcat_ts
DATAFILE '/u01/app/oracle/oradata/ORCL/RCAT/rcat01.dbf'
SIZE 15M
REUSE;
-- create user
CREATE USER rcowner IDENTIFIED BY welcome
DEFAULT TABLESPACE rcat_ts
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON rcat_ts;
-- grant role
GRANT recovery_catalog_owner TO rcowner;
-- connect with catalog
CONNECT CATALOG rcowner@rcat
-- build catalog
CREATE CATALOG;


retention policy-- Note: login using the rcat sid, not the target db sid
rman target sys
-- show current policy
show retention policy;
-- update policy
configure retention policy to redundancy 2;
fast recovery area for Recovery Catalog, enable archive log mode, and back up.-- Note: login using the rcat sid, not the target db sid
sqlplus / as sysdba
ALTER SYSTEM SET db_recovery_file_dest_size=12G SCOPE=BOTH;
When a database is registered:
recovery catalog tables for the target databasecontrol file to the recovery catalog tablesSteps to register database in the Recovery Catalog:
recovery catalog database and to the target database:-- connect
rman TARGET / CATALOG rman/rman@reccatdb
-- register
REGISTER DATABASE;
Register a database with Enterprise Manager:
even if you have previously executed the RMAN REGISTER DATABASE command, you must
recovery catalog to the Enterprise Manager configuration.recovery catalog to be the recovery catalog for the target database.-- Connect
rman target "'/ as sysbackup'" catalog rcat_owner@rcat_service
-- register target database
register database;
-- list all of the data files associated with the target database that have registered in the recovery catalog.
REPORT SCHEMA;


Typically, you would unregister a target database only if you no longer want to use the recovery catalog for that database or the database no longer exists.
You can re-register the database.
control file at the time of re-registration.Enterprise Manager Cloud Control to register your database, you must use it again to unregister your database.rman TARGET / CATALOG username/password@rcat_service
UNREGISTER DATABASE;

resynchronization
recovery catalog by comparing to
control file of the target databasecontrol fileTwo types of resynchronization: partial and full.
partial resynchronization
control file to the recovery catalog and updates the recovery catalog with any metadata concerning backups, archived redo logs, data file copies, and so on.full synchronization,
control file snapshot, which is simply a temporary copy of the control file.recovery catalog.partial resynchronization, but it also includes any database structure changes.
SNAPSHOT CONTROLFILE NAME configuration setting
Oracle RAC configuration, the snapshot control file needs to be globally available to all instances in the RAC configuration.CONTROL_FILE_RECORD_KEEP_TIME initialization parameter
control file before they are candidates for being overwritten.resynchronizations.
recovery catalog was unavailable when you issued RMAN commands that cause a partial resynchronizationredo log switch occurs or when a redo log is archivedtarget databaseRESYNC CATALOG;
-- connect
rman TARGET / CATALOG username/password@rcat_service
-- resync
RESYNC CATALOG;
-- automatically full resync
