RMAN Recovery Catalog (11g)

3
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. Creat e a database for the recov ery catal og (i .e. CATDB). 2. Cr eat e a tabl espace f or the r ecover y cata log . 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. Creat e dat abase user to ho ld r ecovery ca talo g obj ects. 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 t he catalog owner, cr eate the recovery cat alog 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 " TABLESP ACE" 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

Transcript of RMAN Recovery Catalog (11g)

Page 1: RMAN Recovery Catalog (11g)

7/29/2019 RMAN Recovery Catalog (11g)

http://slidepdf.com/reader/full/rman-recovery-catalog-11g 1/3

Use of a recovery catalog is optional although highly recommended. Regardless of whether or not arecovery catalog is being used, the RMAN will "always" write backup metadata to the control file of thetarget database. The following is an example of how to create an RMAN recovery catalog in a newdatabase named CATDB. Note that the owner of an RMAN recovery catalog cannot be the SYS user andthe database hosting the recovery catalog (CATDB in example below) should be a different databasefrom the target database you will be backing up, created on a different host and on different disks than thetarget 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 8gEXTENT 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_catalogTEMPORARY TABLESPACE tempQUOTA 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 usedby 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

Page 2: RMAN Recovery Catalog (11g)

7/29/2019 RMAN Recovery Catalog (11g)

http://slidepdf.com/reader/full/rman-recovery-catalog-11g 2/3

6. 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 RMANenter DROP CATALOG command again to confirm catalog removal

RMAN> drop catalog;

recovery catalog dropped

7. Before using RMAN with a recovery catalog, register the target database(s) in the recoverycatalog. RMAN will obtain all information it needs to register the target database from the targetdatabase itself. As long as each target database has a distinct DBID, you can register more thanone target database in the same recovery catalog. Each database registered in a given catalogmust have a unique database identifier (DBID), but not necessarily a unique database name. Thefollowing example registers a target database named TESTDB1 to the newly created recoverycatalog 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@catd

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 catalogstarting full resync of recovery catalogfull resync complete

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

9. To unregister an existing database, simply connect to that database and to the recovery catalogand 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)? YESdatabase unregistered from the recovery catalog

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

Page 3: RMAN Recovery Catalog (11g)

7/29/2019 RMAN Recovery Catalog (11g)

http://slidepdf.com/reader/full/rman-recovery-catalog-11g 3/3

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 catalog11. 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 removefrom the recovery catalog. Since this method necessitates the need to set the DBID, theunregister 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 DBIDdatabase name is "TESTDB1" and DBID is 527025534

RMAN> unregister database noprompt;

database name is "TESTDB1" and DBID is 527025534database unregistered from the recovery catalog