DBA Tips Archive for Oracle

  


[an error occurred while processing this directive]

No Title

[an error occurred while processing this directive]

by Michael New, MichaelNew@earthlink.net, Gradation LLC

Use of a recovery catalog is optional although highly recommended. Regardless of whether or not a recovery catalog is being used, the RMAN will "always" write backup metadata to the control file of the target database. The following is an example of how to create an RMAN recovery catalog in a new database named CATDB. Note that the owner of an RMAN recovery catalog cannot be the SYS user and the database hosting the recovery catalog (CATDB in example below) should be a different database from the target database you will be backing up, created on a different host and on different disks than the target database.

  1. Create a database for the recovery catalog (i.e. CATDB).

  2. Create a tablespace for the recovery catalog.


    CREATE TABLESPACE rman_catalog DATAFILE SIZE 500m AUTOEXTEND on NEXT 100m MAXSIZE 8g EXTENT MANAGEMENT local UNIFORM SIZE 1m SEGMENT SPACE MANAGEMENT auto; Tablespace created.

  3. Create database user to hold recovery catalog objects.


    CREATE USER rman IDENTIFIED BY rman_pwd DEFAULT TABLESPACE rman_catalog TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON rman_catalog; User created.

  4. Grant the RECOVERY_CATALOG_OWNER role to the new schema owner. This role provides the user with privileges to create, maintain, and query the recovery catalog.


    SQL> GRANT recovery_catalog_owner TO rman; Grant succeeded.

  5. After creating the catalog owner, create the recovery catalog by using the CREATE CATALOG command within the RMAN interface. This command will create the catalog in the default tablespace of the catalog owner or you can explicitly set the tablespace name to be used by using the "TABLESPACE" option as shown below.


    % rman catalog rman/rman_pwd@catdb Recovery Manager: Release 11.2.0.3.0 - Production on Mon May 13 16:47:42 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to recovery catalog database RMAN> create catalog tablespace rman_catalog; recovery catalog created

    Just as you can create the recovery catalog schema, you can also remove it using the DROP CATALOG command. Of course, all data contained in the schema will be lost so take a backup before dropping the catalog.


    RMAN> drop catalog; recovery catalog owner is RMAN enter DROP CATALOG command again to confirm catalog removal RMAN> drop catalog; recovery catalog dropped

  6. Before using RMAN with a recovery catalog, register the target database(s) in the recovery catalog. RMAN will obtain all information it needs to register the target database from the target database itself. As long as each target database has a distinct DBID, you can register more than one target database in the same recovery catalog. Each database registered in a given catalog must have a unique database identifier (DBID), but not necessarily a unique database name. The following example registers a target database named TESTDB1 to the newly created recovery catalog within the database named CATDB. The target database must be either mounted or opened in order to register it.


    % rman target backup_admin/backup_admin_pwd@testdb1 catalog rman/rman_pwd@catdb Recovery Manager: Release 11.2.0.3.0 - Production on Mon May 13 17:03:41 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: TESTDB1 (DBID=527025534) connected to recovery catalog database RMAN> register database; database registered in recovery catalog starting full resync of recovery catalog full resync complete

    As easy as it is to register a target database in the recovery catalog, it is just as easy to unregister a database.

    To unregister an existing database, simply connect to that database and to the recovery catalog and issue the following command:


    RMAN> unregister database; database name is "TESTDB1" and DBID is 527025534 Do you really want to unregister the database (enter YES or NO)? YES database unregistered from the recovery catalog

    If the database has been removed then in most cases, all you need to supply is the name of the database. For example, to remove the TESTDB1 database, issue the following command:


    RMAN> unregister database testdb1; database name is "TESTDB1" and DBID is 527025534 Do you really want to unregister the database (enter YES or NO)? YES database unregistered from the recovery catalog

    A more difficult situation exists when multiple databases with the same name are registered in the recovery catalog. In this case, you need to know the DBID for the database you want to remove from the recovery catalog. Since this method necessitates the need to set the DBID, the unregister command will need to be performed within a run block:


    % rman catalog rman/rman_pwd@catdb Recovery Manager: Release 11.2.0.3.0 - Production on Mon May 13 17:23:50 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to recovery catalog database RMAN> set dbid 527025534; executing command: SET DBID database name is "TESTDB1" and DBID is 527025534 RMAN> unregister database noprompt; database name is "TESTDB1" and DBID is 527025534 database unregistered from the recovery catalog

About the Author

Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX / Linux server environment. Jeff's other interests include mathematical encryption theory, tutoring advanced mathematics, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 20 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science and Mathematics.



Copyright (c) 1998-2017 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Monday, 13-May-2013 18:11:01 EDT
Page Count: 4943