Step by Step - How to Create And Configure RMAN Recovery Catalog Database



Purpose of the Recovery Catalog

recovery catalog is a database schema used by RMAN to store metadata about one or more Oracle databases. Typically, you store the catalog in a dedicated database. A recovery catalog provides the following benefits:
  • A recovery catalog creates redundancy for the RMAN repository stored in the control file of each target database. The recovery catalog serves as a secondary metadata repository. If the target control file and all backups are lost, then the RMAN metadata still exists in the recovery catalog.
  • A recovery catalog centralizes metadata for all your target databases. Storing the metadata in a single place makes reporting and administration tasks easier to perform.
  • A recovery catalog can store metadata history much longer than the control file. This capability is useful if you must do a recovery that goes further back in time than the history in the control file. The added complexity of managing a recovery catalog database can be offset by the convenience of having the extended backup history available.
Some RMAN features function only when you use a recovery catalog. For example, you can store RMAN scripts in a recovery catalog. The chief advantage of a stored script is that it is available to any RMAN client that can connect to the target database and recovery catalog. Command files are only available if the RMAN client has access to the file system on which they are stored.
A recovery catalog is required when you use RMAN in a Data Guard environment. By storing backup metadata for all primary and standby databases, the catalog enables you to offload backup tasks to one standby database while enabling you to restore backups on other databases in the environment.

Basic Concepts for the Recovery Catalog

The recovery catalog contains metadata about RMAN operations for each registered target database. When RMAN is connected to a recovery catalog, RMAN obtains its metadata exclusively from the catalog. The catalog includes the following types of metadata:
  • Datafile and archived redo log backup sets and backup pieces
  • Datafile copies
  • Archived redo logs and their copies
  • Database structure (tablespaces and datafiles)
  • Stored scripts, which are named user-created sequences of RMAN commands
  • Persistent RMAN configuration settings

Database Registration

The process of enrolling of a database in a recovery catalog for RMAN use is called registration. The recommended practice is to register every target database in your environment in a single recovery catalog. For example, you can register databases prod1prod2, and prod3 in a single catalog owned by catowner in the database RMANCAT.

Creating a Recovery Catalog

Configuring the Recovery Catalog Database

When you use a recovery catalog, RMAN requires that you maintain a recovery catalog schema. The recovery catalog is stored in the default tablespace of the schema. The SYS user cannot be the owner of the recovery catalog.
Decide which database you will use to install the recovery catalog schema, and also how you will back up this database. Also, decide whether to operate the catalog database in ARCHIVELOG mode, which is recommended.

Steps to Create a RMAN Catalog User

  1. Suppose you have create a oracle database or you already have a database created. We are considering RMANCAT as our Recovery Catalog Database. Connect to database RMANCAT as show below. 
      • export ORACLE_SID=RMANCAT
        [oracle@ ~]$sys
        
        SQL*Plus: Release 12.2.0.1.0 Production on Tue Oct 31 17:14:17 2017
        
        Copyright (c) 1982, 2016, Oracle.  All rights reserved.
        
        
        Connected to:
        Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
        
        SQL> select name from v$database;
        
        NAME
        ---------
        RMANCAT
         
        
      1. Create a tablespace and schema for the recovery catalog.
          •  
            SQL> CREATE TABLESPACE RMAN
            DATAFILE '/u02/oradata/RMANCAT/rman01.dbf' SIZE 6208K REUSE
            AUTOEXTEND ON NEXT 64K MAXSIZE 32767M
            EXTENT MANAGEMENT LOCAL
            SEGMENT SPACE MANAGEMENT AUTO;  2    3    4    5
            
            Tablespace created.
            
            SQL> CREATE USER rman IDENTIFIED BY rman
            TEMPORARY TABLESPACE temp
            DEFAULT TABLESPACE rman
            QUOTA UNLIMITED ON rman;  2    3    4
            
            User created.
            
            SQL> GRANT connect, resource, recovery_catalog_owner TO rman;
            
            Grant succeeded.
            
            SQL>
              
            
          1. Grant the RECOVERY_CATALOG_OWNER role to the schema owner. This role provides the user with all privileges required to maintain and query the recovery catalog.
              •  SQL> grant RECOVERY_CATALOG_OWNER TO rman;  
                
              1.  After creating the catalog owner, create the catalog tables with the RMAN CREATE CATALOG command. The command creates the catalog in the default tablespace of the catalog owner.
                  • [oracle@ ~]$rman catalog=rman/rman@RMANCAT
                    
                    Recovery Manager: Release 12.2.0.1.0 - Production on Tue Oct 31 18:03:06 2017
                    
                    Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
                    
                    connected to recovery catalog database
                    
                    RMAN> CREATE CATALOG TABLESPACE "RMAN";
                    
                    recovery catalog created
                    
                    RMAN> exit
                    
                    
                    Recovery Manager complete.
                    
                    
                  1. You can now connect to the catalog user from sqlplus to check the tables and view names created by the above command.
                      • 
                        [oracle@fcias-oem-01 ~]$sys
                        
                        SQL*Plus: Release 12.2.0.1.0 Production on Tue Oct 31 18:32:38 2017
                        
                        Copyright (c) 1982, 2016, Oracle.  All rights reserved.
                        
                        
                        Connected to:
                        Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
                        
                        SQL> conn rman/rman
                        Connected.
                        SQL>  select * from tab;
                        
                        
                      • 
                        

                      Registering a Database with the REGISTER DATABASE Command

                      1. The first step in using a recovery catalog with a target database is registering the target database in the recovery catalog. 
                      2. Start RMAN and connect to a target database and recovery catalog. The recovery catalog database must be open. 
                          • [oracle@~]$rman target=/ catalog=rman/rman@RMANCAT
                            
                            Recovery Manager: Release 12.2.0.1.0 - Production on Tue Oct 31 18:30:12 2017
                            
                            Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
                            
                            connected to target database: RMANCAT (DBID=4044589590)
                            connected to recovery catalog database
                            
                            RMAN> 
                            
                          1. Register the target database in the connected recovery catalog. RMAN creates rows in the catalog tables to contain information about the target database, then copies all pertinent data about the target database from the control file into the catalog, synchronizing the catalog with the control file.
                            • RMAN> REGISTER DATABASE;
                              
                              database registered in recovery catalog
                              starting full resync of recovery catalog
                              full resync complete
                              
                              RMAN>
                          2. Verify that the registration was successful by running REPORT SCHEMA
                            •  RMAN> report schema
                              2> ;
                              
                              starting full resync of recovery catalog
                              full resync complete
                              Report of database schema for database with db_unique_name RMANCAT
                              
                              List of Permanent Datafiles
                              ===========================
                              File Size(MB) Tablespace           RB segs Datafile Name
                              ---- -------- -------------------- ------- ------------------------
                              1    810      SYSTEM               YES     /u02/oradata/RMANCAT/system01.dbf
                              3    480      SYSAUX               NO      /u02/oradata/RMANCAT/sysaux01.dbf
                              4    230      UNDOTBS1             YES     /u02/oradata/RMANCAT/undotbs01.dbf
                              5    8        RMAN                 NO      /u02/oradata/RMANCAT/rman01.dbf
                              7    5        USERS                NO      /u02/oradata/RMANCAT/users01.dbf
                              
                              List of Temporary Files
                              =======================
                              File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
                              ---- -------- -------------------- ----------- --------------------
                              1    32       TEMP                 32767       /u02/oradata/RMANCAT/temp01.dbf
                              
                              RMAN>
                              

                          No comments:

                          Post a Comment