Oracle RMAN 11g Backup and Recovery (75 page)

210
Part II: Setup Principles and Practices

RMAN Workshop:
Create the Recovery Catalog

User Account

Workshop Notes

For this workshop, you need an installation of the Oracle software. You also need to identify a database to create the recovery catalog schema in. You need administrative privileges in this database to create the recovery catalog user account. Finally, determine the name and password you will assign to the recovery catalog user account.

You should create a tablespace for the recovery catalog schema objects. We suggest that you size the tablespace at about 15MB to start.

Step 1.
Create the recovery catalog user. Make sure you do not use the SYSTEM tablespace as the temporary tablespace (check out the Oracle Database 11
g
default temporary tablespace feature!). Assign the recovery catalog tablespace that you have created (as suggested in the

“Workshop Notes”) to this schema as its default tablespace. Also, assign the recovery catalog user to an
unlimited quota
on the recovery catalog tablespace. Here is an example of this operation: CREATE USER rcat user IDENTIFIED BY rcat password

DEFAULT TABLESPACE catalog;

Step 2.
Grant the following roles to the recovery catalog user:

■ connect

■ resource

■ recovery_catalog_owner

Here is an example of granting the RCAT_USER user we created earlier the roles it requires: GRANT connect, resource, recovery catalog owner TO rcat user;

NOTE

The recovery catalog user account is somewhat of a privileged

database account. Secure it as you would sys or system.

Creating the Recovery Catalog Schema Objects

Now that you have created the recovery catalog database and user, it’s time to actually create the recovery catalog. This is a pretty simple process in Oracle Database 11
g
. All you need to do is use RMAN. When you start RMAN, use the
target
parameter to connect to the target database, and use the
catalog
parameter to connect to the recovery catalog database schema (which you just created).

At the RMAN prompt, you then issue the
create catalog
command. Optionally, you can use the
tablespace
parameter to define a tablespace in which to create the RMAN schema objects.

The next RMAN Workshop provides an example of using the
create catalog
command to create the recovery catalog schema.

Chapter 10: Using the Recovery Catalog
211

RMAN Workshop:
Create the Recovery Catalog

Workshop Notes

For this workshop, you should have completed the previous RMAN Workshop (“Create the Recovery Catalog User Account”). Also, we assume that you have created a tablespace called CATALOG_TBS, and we will be creating the RMAN schema objects in that tablespace.

Step 1.
Connect to the recovery catalog with RMAN:

RMAN catalog rcat user/rcat password

Step 2.
Issue the
create catalog
command from the RMAN prompt: create catalog tablespace catalog tbs;

Register the Database with the Recovery Catalog

Now that you have prepared the recovery catalog for use, you need to register databases with it.

This is required before you can perform an RMAN backup of a database by using the recovery catalog. This is a rather simple process, as you can see in the associated RMAN Workshop.

RMAN Workshop:
Register Your Database in the

Recovery Catalog

Workshop Notes

For this workshop, you should have completed the previous RMAN Workshop (“Create the Recovery Catalog”).

Step 1.
Using RMAN, sign into the database and the recovery catalog at the same time: set ORACLE SID main db

RMAN target backup admin/backupuserpassword

CATALOG rcat user/rcat password@recover

Step 2.
Register the database with the recovery catalog:

RMAN> Register database;

Step 3. (optional)
Verify that the registration of the database was successful by issuing the
report schema
command from the RMAN prompt when connected to the target database: RMAN> Report Schema;

Dropping the Recovery Catalog

Just as you can create the recovery catalog schema, you may wish to drop it. Use the
drop catalog
command to drop the recovery catalog schema. Of course, you should understand that all the

212
Part II: Setup Principles and Practices

information contained in the schema is going to be lost, so you should consider backing up the recovery catalog database before you drop the catalog schema.

Adding RMAN Backups to the Recovery Catalog

If you have already executed RMAN backups without a recovery catalog and you wish to add them to the recovery catalog later, you can use the
catalog
command. You can catalog datafile copies, back up set pieces, archive log backups, and even archive whole directories of backups, as shown in the following examples:

RMAN> CATALOG DATAFILECOPY 'D:\ORACLE\ORA102\DATABASE\system01.dbf';

RMAN> CATALOG ARCHIVELOG 'D:\ORACLE\ORA102\DATABASE\arch 988.arc',

'D:\ORACLE\ORA102\DATABASE\arch 988.arc';

RMAN> CATALOG BACKUPPIECE 'D:\ORACLE\ORA102\DATABASE\backup 820.bkp'; RMAN> CATALOG START WITH 'D:\ORACLE\ORA102\DATABASE\';

NOTE

Beware of the
catalog start with
command. You must have the
trailing backslash at the end of the directory path. If you were to use
D:\ORACLE\ORA102\DATABASE instead, Oracle would traverse

all possible directory combinations of DATABASE that are available

in C:\ORACLE\ORA102. This might include directories such as C:\

ORACLE\ORA102\DATABASE, C:\ORACLE\ORA102\DATABASE-

123, and C:\ORACLE\ORA102\DATABASE-OLD. Use the trailing

backslash to indicate that you just want C:\ORACLE\ORA102\

DATABASE\.

Unregistering a Database from the Recovery Catalog

You can use the
unregister database
command in RMAN to unregister a database. If you wish to unregister an existing database, simply connect to that database and to the recovery catalog, and issue the
unregister database
command:

RMAN>unregister database;

If the database has been removed and you wish to remove it from the recovery catalog, you simply need to know the name of the database you wish to unregister, in most cases. If you wish to unregister the OLDROB database, you would issue this command after connecting to the recovery catalog:

RMAN>unregister database OLDROB;

In cases where multiple databases with the same name are registered in the recovery catalog, you need to know the DBID for the database that you wish to unregister. You then need to run the
unregister database
command in a
run
block, while also using the
set dbid
command, as shown in this example:

rman CATALOG rman/rman@catdb

RMAN> RUN

{ SET DBID 2414555533; # specifies the database by DBID

UNREGISTER DATABASE ROBOLD NOPROMPT;

}

Chapter 10: Using the Recovery Catalog
213

Utilizing a Virtual Private Catalog

In 11
g,
you can extend your catalog to be utilized by multiple users who can all independently log in create/view records in the catalog. Prior to this version, everyone was required to use the same RMAN user and would have access to information about all databases in the environment that were registered in this particular catalog. This led to security issues in a single catalog, or to catalog sprawl as all users created and maintained their own catalogs.

Now, a single recovery catalog can be utilized by multiple users through the implementation of a virtual private catalog (VPC). A virtual private catalog allows you to grant access to the catalog to a database user, but to allow access just to particular databases within that environment.

To build virtual private catalogs for users, you will need to perform actions in SQL*Plus on the recovery catalog database, as well as actions from within RMAN. First, you must log into the database and grant the role recovery_catalog_owner to the database user that will have a VPC.

Then, you log into RMAN as your catalog owner and grant privileges—either CATALOG privileges for existing databases that are already registered, or REGISTER privileges so the user can register new databases.

In addition to creating the VPC, you can also revoke privileges and delete the VPC.

RMAN Workshop:
Create a Virtual Private Catalog

Workshop Notes

In this catalog, we will create a VPC for user farouka in the database. The catalog is owned by rcat_user. The user farouka will need to manage 10
g
and 11
g
databases.

Step 1.
Grant access to the catalog from within the database.

Sqlplus system/password

Other books

Prerequisites for Sleep by Jennifer L. Stone
Madam President by Cooper, Blayne, Novan, T
On Shadow Beach by Freethy, Barbara
Mind Games by Teri Terry
GROOM UNDER FIRE by LISA CHILDS,
Chasing Down Secrets by Katie Matthews
Love Life by Rob Lowe