In this section, I will show, how to create RMAN catalog and how to administer it.
For this practice, I have created 2 new WM machines and installed Oracle 11.2.0.3 on the. the first one will be my test server where I will do all the backup/recovery and thw other will work as a recovery catalog.
What is the recovery catalog? Oracle maintains all of the metadata related to RMAN operations in the RMAN repository. The RMAN repository is allways stored in the control file of the target database. In some cases, you might want to store the RMAN repository in another location. This location is called RMAN recovery catalog.
The test database should be in archivelog mode. Only in this mode we will be able to do the online backups.
Here are the steps, to put your DB in archivelog mode:
SQL> alter system set log_archive_dest='/oracle/oarch' scope=spfile;
System altered.
SQL> shu immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 234356736 bytes
Fixed Size 1344088 bytes
Variable Size 146804136 bytes
Database Buffers 83886080 bytes
Redo Buffers 2322432 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
Creating the Recovery Catalog
First, we should create a new tablespace in the DB.
SQL> create tablespace catalog datafile '/oracle/oradata/catalog01.dbf' size 100M;
Tablespace created.
Now, we can create a new user account for the RMAN:
SQL> create user rcat identified by testOra1 default tablespace catalog;
User created.
SQL> alter user rcat quota unlimited on catalog;
User altered.
SQL> grant connect,resource,recovery_catalog_owner to rcat;
Grant succeeded.
Creating the Recovery Catalog Schema Objects
connect to the catalog and create the schema objects:
[oracle@rcat oracle]$ rman catalog rcat/**********
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 5 15:18:49 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
RMAN> create catalog tablespace "CATALOG";
recovery catalog created
Register the Database with the Recovery Catalog
On the target DB, run this commands:
[oracle@btest oracle]$ rman target / catalog rcat/*********@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 5 15:43:22 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
Unregistering a Database from the Recovery Catalog
If you want to unregister a database, you have just to connect to the DB and recovery catalog and issue:
[oracle@btest oracle]$ rman target / catalog rcat/******@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 6 08:33:41 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> unregister database;
database name is "BTEST" and DBID is 4236471253
Do you really want to unregister the database (enter YES or NO)? YES
database unregistered from the recovery catalog
If your database was deleted, you have to connect to the recovery catalog and specify the DB name:
[oracle@rcat oracle]$ rman catalog rcat/*********@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 6 08:32:11 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
RMAN> unregister database BTEST;
database name is "BTEST" and DBID is 4236471253
Do you really want to unregister the database (enter YES or NO)? Y
database unregistered from the recovery catalog
If you have more databases with same name, you should set dbid before unregistering the database:
RMAN> set dbid 4236471253;
executing command: SET DBID
database name is "BTEST" and DBID is 4236471253
RMAN> unregister database;
database name is "BTEST" and DBID is 4236471253
Do you really want to unregister the database (enter YES or NO)? Y
database unregistered from the recovery catalog
Manually Resynchronizing the Recovery Catalog:
Normaly, the RMAN using resymchrozation after every backup to ensure, taht the rpository is synchronized with the control file. If you, from time to time, running backups with nocatalog, you shold manually synchronize catalog with control file:
[oracle@btest oracle]$ rman target / catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 6 09:24:53 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
Recovery catalog views:
RC_ARCHIVED_LOG (V$ARCHIVED_LOG) - information about all archived logs that have been generated by target DB.
on the target DB:
[oracle@btest oracle]$ sqlplus "/ as sysdba"
SQL> set lines 200
SQL> col name for a50
SQL> col completion_time for a25
SQL> select name,sequence#,status,completion_time from v$archived_log;
NAME SEQUENCE# S COMPLETION_TIME
-------------------------------------------------- ---------- - -------------------------
/oracle/oarch/1_14_769077077.dbf 14 A 06-DEC-11
on Recovery manager:
[oracle@rcat oracle]$ sqlplus
SQL*Plus: Release 11.2.0.3.0 Production on Tue Dec 6 09:33:43 2011
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter user-name: rcat
Enter password:
SQL> set lines 200
SQL> col name for a50
SQL> col completion_time for a25
SQL> select name,sequence#,status,completion_time from rc_archived_log;
NAME SEQUENCE# S COMPLETION_TIME
-------------------------------------------------- ---------- - -------------------------
/oracle/oarch/1_14_769077077.dbf 14 A 06-DEC-11
RC_BACKUP_CONTROLFILE (V$BACKUP_DATAFILE) - info about backups of controlfile
SQL> select file#,creation_time,resetlogs_time,blocks,block_size,controlfile_type from v$backup_datafile where file#=0;
RC_BACKUP_CORRUPTION (V$BACKUP_CORRUPTION) - list the corruption that exists in datafile backups
RC_BACKUP_DATAFILE (V$BACKUP_DATAFILE) - This view has extensive information about datafiles that exists in backup
sets.
RC_BACKUP_FILES (V$BACKP_FILES) - This view most completely corresponds to the information provided by the commands
list backup and list copy from the RMAN command-line interface.
To use this view, you have to call dbms_rcvman.setdatabase to indicate which DB you want to use:
call dbms_rcvman.setdatabase(null,null,null,2283997583,null)
RC_BACKUP_PIECE (V$BACKUP_PIECE) - view information about specific backup pieces that have been created during
normal backup operation.
RC_BACKUP_REDOLOG (V$BACKUP_REDOLOG) - list archive logs that exists in backup sets.
RC_BACKUP_SET (V$BACKUP_SET) - information in this view refers to each logical backup set.
RC_BACKUP_SPFILE (V$BACKUP_SPFILE) - information about spfile backups.
RC_CONTROLFILE_COPY (V$CONTROLFILE_COPY) - information about controlfile backup created by copy command or
cataloged with the catalog command.
RC_COPY_CORRUPTION (V$COPY_CORRUPTION) - info about blocks that are corrupt in copies.
RC_DATABASE (V$DATABASE) - basic info about each database registered in the catalog.
RC_DATABASE_BLOCK_CORRUPTION (V$DATABASE_BLOCK_CORRUPTION) - This view provides the corruption list that is
populated when a backup or backup validate operation discovers corrupt block.
RC_DATABASE_INCARNATION (V$DATABASE_INCARNATION) - this view contains a record for each incarnation of each
database registered in catalog
RC_DATAFILE (V$DATAFILE) - info about datafiles
RC_DATAFILE_COPY (V$DATAFILE_COPY) - metadata about datafile copies created by the copy command
RC_LOG_HISTORY (V$LOG_HISTORY) - historical info about online redo logs
RC_OFFLINE_RANGE (V$OFFLIE_RANGE) - when datafiles came online/offline/read only
RC_REDO_LOg (V$REDO_LOG) - info about redologs
RC_REDO_THREAD (V$REDO_THREAD) - important only in RAC environment
RC_RESYNC - info for each resync operation that occurs
RC_RMAN_CONFIGURATION (V$RMAN_CONFIGURATION) - equivalent for the show all command
RC_TABLESPACE (V$TABLESPACE) - ifo about tablesapces
RC_TEMPFILE (V$TEMPFILE) - info about tempfiles
What is the recovery catalog? Oracle maintains all of the metadata related to RMAN operations in the RMAN repository. The RMAN repository is allways stored in the control file of the target database. In some cases, you might want to store the RMAN repository in another location. This location is called RMAN recovery catalog.
The test database should be in archivelog mode. Only in this mode we will be able to do the online backups.
Here are the steps, to put your DB in archivelog mode:
SQL> alter system set log_archive_dest='/oracle/oarch' scope=spfile;
System altered.
SQL> shu immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 234356736 bytes
Fixed Size 1344088 bytes
Variable Size 146804136 bytes
Database Buffers 83886080 bytes
Redo Buffers 2322432 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
Creating the Recovery Catalog
First, we should create a new tablespace in the DB.
SQL> create tablespace catalog datafile '/oracle/oradata/catalog01.dbf' size 100M;
Tablespace created.
Now, we can create a new user account for the RMAN:
SQL> create user rcat identified by testOra1 default tablespace catalog;
User created.
SQL> alter user rcat quota unlimited on catalog;
User altered.
SQL> grant connect,resource,recovery_catalog_owner to rcat;
Grant succeeded.
Creating the Recovery Catalog Schema Objects
connect to the catalog and create the schema objects:
[oracle@rcat oracle]$ rman catalog rcat/**********
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 5 15:18:49 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
RMAN> create catalog tablespace "CATALOG";
recovery catalog created
Register the Database with the Recovery Catalog
On the target DB, run this commands:
[oracle@btest oracle]$ rman target / catalog rcat/*********@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 5 15:43:22 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
Unregistering a Database from the Recovery Catalog
If you want to unregister a database, you have just to connect to the DB and recovery catalog and issue:
[oracle@btest oracle]$ rman target / catalog rcat/******@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 6 08:33:41 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> unregister database;
database name is "BTEST" and DBID is 4236471253
Do you really want to unregister the database (enter YES or NO)? YES
database unregistered from the recovery catalog
If your database was deleted, you have to connect to the recovery catalog and specify the DB name:
[oracle@rcat oracle]$ rman catalog rcat/*********@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 6 08:32:11 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
RMAN> unregister database BTEST;
database name is "BTEST" and DBID is 4236471253
Do you really want to unregister the database (enter YES or NO)? Y
database unregistered from the recovery catalog
If you have more databases with same name, you should set dbid before unregistering the database:
RMAN> set dbid 4236471253;
executing command: SET DBID
database name is "BTEST" and DBID is 4236471253
RMAN> unregister database;
database name is "BTEST" and DBID is 4236471253
Do you really want to unregister the database (enter YES or NO)? Y
database unregistered from the recovery catalog
Manually Resynchronizing the Recovery Catalog:
Normaly, the RMAN using resymchrozation after every backup to ensure, taht the rpository is synchronized with the control file. If you, from time to time, running backups with nocatalog, you shold manually synchronize catalog with control file:
[oracle@btest oracle]$ rman target / catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 6 09:24:53 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
Recovery catalog views:
RC_ARCHIVED_LOG (V$ARCHIVED_LOG) - information about all archived logs that have been generated by target DB.
on the target DB:
[oracle@btest oracle]$ sqlplus "/ as sysdba"
SQL> set lines 200
SQL> col name for a50
SQL> col completion_time for a25
SQL> select name,sequence#,status,completion_time from v$archived_log;
NAME SEQUENCE# S COMPLETION_TIME
-------------------------------------------------- ---------- - -------------------------
/oracle/oarch/1_14_769077077.dbf 14 A 06-DEC-11
on Recovery manager:
[oracle@rcat oracle]$ sqlplus
SQL*Plus: Release 11.2.0.3.0 Production on Tue Dec 6 09:33:43 2011
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter user-name: rcat
Enter password:
SQL> set lines 200
SQL> col name for a50
SQL> col completion_time for a25
SQL> select name,sequence#,status,completion_time from rc_archived_log;
NAME SEQUENCE# S COMPLETION_TIME
-------------------------------------------------- ---------- - -------------------------
/oracle/oarch/1_14_769077077.dbf 14 A 06-DEC-11
RC_BACKUP_CONTROLFILE (V$BACKUP_DATAFILE) - info about backups of controlfile
SQL> select file#,creation_time,resetlogs_time,blocks,block_size,controlfile_type from v$backup_datafile where file#=0;
RC_BACKUP_CORRUPTION (V$BACKUP_CORRUPTION) - list the corruption that exists in datafile backups
RC_BACKUP_DATAFILE (V$BACKUP_DATAFILE) - This view has extensive information about datafiles that exists in backup
sets.
RC_BACKUP_FILES (V$BACKP_FILES) - This view most completely corresponds to the information provided by the commands
list backup and list copy from the RMAN command-line interface.
To use this view, you have to call dbms_rcvman.setdatabase to indicate which DB you want to use:
call dbms_rcvman.setdatabase(null,null,null,2283997583,null)
RC_BACKUP_PIECE (V$BACKUP_PIECE) - view information about specific backup pieces that have been created during
normal backup operation.
RC_BACKUP_REDOLOG (V$BACKUP_REDOLOG) - list archive logs that exists in backup sets.
RC_BACKUP_SET (V$BACKUP_SET) - information in this view refers to each logical backup set.
RC_BACKUP_SPFILE (V$BACKUP_SPFILE) - information about spfile backups.
RC_CONTROLFILE_COPY (V$CONTROLFILE_COPY) - information about controlfile backup created by copy command or
cataloged with the catalog command.
RC_COPY_CORRUPTION (V$COPY_CORRUPTION) - info about blocks that are corrupt in copies.
RC_DATABASE (V$DATABASE) - basic info about each database registered in the catalog.
RC_DATABASE_BLOCK_CORRUPTION (V$DATABASE_BLOCK_CORRUPTION) - This view provides the corruption list that is
populated when a backup or backup validate operation discovers corrupt block.
RC_DATABASE_INCARNATION (V$DATABASE_INCARNATION) - this view contains a record for each incarnation of each
database registered in catalog
RC_DATAFILE (V$DATAFILE) - info about datafiles
RC_DATAFILE_COPY (V$DATAFILE_COPY) - metadata about datafile copies created by the copy command
RC_LOG_HISTORY (V$LOG_HISTORY) - historical info about online redo logs
RC_OFFLINE_RANGE (V$OFFLIE_RANGE) - when datafiles came online/offline/read only
RC_REDO_LOg (V$REDO_LOG) - info about redologs
RC_REDO_THREAD (V$REDO_THREAD) - important only in RAC environment
RC_RESYNC - info for each resync operation that occurs
RC_RMAN_CONFIGURATION (V$RMAN_CONFIGURATION) - equivalent for the show all command
RC_TABLESPACE (V$TABLESPACE) - ifo about tablesapces
RC_TEMPFILE (V$TEMPFILE) - info about tempfiles