MERCADOS FINANCIEROS

martes, 22 de septiembre de 2009

Using the Recovery Catalog

Creating the Recovery Catalog Owner

Follow these steps to create the recovery catalog owner:

1. Using SQL*Plus, connect as the user sys to the database where you want to create the
recovery catalog. For example:

SQL> connect sys/oracle@catdb as sysdba

2. Create a default tablespace for the RMAN recovery catalog owner you’re about to create.

Otherwise, the system tablespace may be used by default to hold the recovery
catalog structures, and it’s not a smart idea to let that happen. This example creates a
tablespace named cattbs:

SQL> create tablespace cattbs
datafile '/u10/oradata/catdb/cattbs_01.dbf' size 500M;
Tablespace created.

SQL>
3. Create the recovery catalog owner. This example creates a user named rman to own the
catalog:

SQL> create user rman identified by rman
temporary tablespace temp
default tablespace cattbs
quota unlimited on cattbs;
User created.

SQL>
The default tablespace of the recovery catalog owner in this example is the cattbs
tablespace created in the previous step.

4. Once you create the recovery catalog owner, you must grant that user the
recovery_catalog_owner privilege in order for that user to have the authority to work
with the recovery catalog you’ll create in the next step. This recovery catalog owner is
named rman, so grant the recovery_catalog_owner privilege to that user:

SQL> grant recovery_catalog_owner to rman;
SQL> exit;

Creating the Recovery Catalog
Once you’ve created the recovery catalog schema, your next step is to create the recovery catalog.
You must connect to the recovery catalog, but not to a target database, when you do this.
Here are the steps you must follow to create the recovery catalog:

1. Connect to the RMAN catalog database by starting up the RMAN client and using the
connect catalog command. You must connect as the recovery catalog owner you created
in the previous section.

RMAN> connect catalog rman/cat@catdb
connected to recovery catalog database

RMAN>
2. Using the create catalog command, create the recovery catalog. RMAN will create the
recovery catalog in the default tablespace of the recovery catalog owner. For example:

RMAN> create catalog;
recovery catalog created
RMAN>

Granting Restricted Access


SQL> create user virtual1 identified by virtual1
2 temporary tablespace temp
3 default tablespace vp_users
4 quota unlimited on vp_users;
User created.

Grant the new user the recovery_catalog_owner role, just as you do when you create a
base recovery catalog:

SQL> grant recovery_catalog_owner to virtual1;
Grant succeeded.

Connect to the recovery catalog database as the base recovery catalog owner, and grant

the new user virtual1 restricted access (virtual private catalog access) to just one database,
orcl11, from the base recovery catalog. You grant the catalog for database
privilege to the new user in order to do this:

$ rman
Recovery Manager: Release 11.1.0.1.0 - Beta on Sun Apr 8 13:19:30 2
Copyright (c) 1982, 2005, Oracle. All rights reserved.

RMAN> connect catalog rman/rman@nick
connected to recovery catalog database

RMAN> grant catalog for database orcl11 to virtual1;
Grant succeeded.

Now that the virtual private catalog owner has the catalog for database privilege, that
user can log in to the base recovery catalog and create the virtual private catalog:

RMAN> connect catalog virtual1/virtual1@nick
connected to recovery catalog database

RMAN> create virtual catalog;
found eligible base catalog owned by RMAN
created virtual catalog against base catalog owned by RMAN

RMAN> list incarnation;


The catalog for database privilege shown here grants the virtual catalog user access to a
database already registered in the base recovery catalog:

RMAN> connect catalog rman/rman@catdb

RMAN> grant catalog for database prod1 to virtual1;

By granting the register database privilege as shown in the following example, you grant
a user the ability to register new databases in the virtual private catalog and, implicitly, in the
base recovery catalog as well:

RMAN> connect catalog rman/rman@catdb

RMAN> grant register database to virtual1;

RMAN> revoke catalog for database prod1 from virtual1;

RMAN> revoke all privileges from virtual1;


If you’re using an Oracle 10.2 or older release of RMAN, you must perform the following

steps in order to use a virtual private catalog. Connect to the base recovery catalog as the virtual
catalog owner, and execute the create_virtual_catalog procedure as shown here:

SQL> execute base_catalog_owner.dbms_rcvcat.create_virtual_catalog;

Connecting to the Catalog from the Command Line

$ rman target / catalog rman/rman@catalog_db

$ rman target sys/power@target_db catalog rman/rman@cat10g


Connecting to the Catalog from the RMAN Prompt

RMAN> connect target /

You can then use Oracle Net authentication to connect to the recovery catalog:

RMAN> connect catalog rman/rman@cat10g

RMAN> register database;
RMAN> unregister database;
RMAN> unregister database POWER;

RMAN> run
{
set dbid 1234567899;
unregister database POWER;
}

Cataloging Older Files

RMAN> catalog datafilecopy '/u01/app/oracle/users01.dbf';
cataloged datafile copy
datafile copy filename=/u01/app/oracle/users01.dbf recid=2 stamp=604202000

RMAN> catalog backuppiece '/disk1/backups/backup_820.bkp';

Cataloging Sets of Files

RMAN> catalog start with '/disk1/arch_logs/';

RMAN> catalog recovery area;

Updating the Recovery Catalog

RMAN> resync catalog;

Dropping the Recovery Catalog

RMAN> connect catalog rman/rman@catdb
Connected to recovery catalog database

RMAN> drop catalog;

Merging Recovery Catalogs

RMAN> connect catalog rman/rman@eleven
RMAN> import catalog rman10/rman10@tenner;

RMAN> import catalog rman10/rman10@tenner dbid = 123456, 123457;

RMAN> import catalog rman10/rman10@tenner db_name = testdb, mydb;

If you don’t want RMAN to unregister the databases
from the source catalog after importing the metadata for the databases registered in that
catalog, issue the following import catalog command, with the no unregister option:

RMAN> import catalog rman10/rman10@tenner no unregister;

Moving the Recovery Catalog to Another Database

RMAN> connect catalog rman/rman@target_db
RMAN> import catalog rman10/rman10@source_db;

Viewing Backup Information

SQL> connect / as sysdba
SQL> select DBID from v$database;
DBID
--------
6325412

connect rman/cat@catdb

RC_STORED_SCRIPT: This view lists information about RMAN scripts stored in the recovery
catalog.

RC_UNUSABLE_BACKUPFILE_DETAILS: This view shows the unusable backup files
recorded in the recovery catalog.

RC_RMAN_STATUS: This view is similar to the V$RMAN_STATUS view and shows the status
of all RMAN operations. This view doesn’t contain information about any operations
that are currently executing.

RC_RMAN_CONFIGURATION: This view provides information about persistent configuration
settings.

RC_DATAFILE: This view shows all datafiles registered in the recovery catalog.

RC_DATABASE: This view shows the databases registered in the recovery catalog.

RC_ARCHIVED_LOG: This view provides historical information on both archived as well
as unarchived redo logs.


Uncataloging RMAN Records

RMAN> change controlfilecopy '/u01/app/oracle/rman/backup/control01.ctl' uncatalog;
RMAN> change datafilecopy '/u01/app/oracle/rman/backup/users01.ctl' uncatalog;

Using a Release 11.x Client with Older Catalogs
RMAN> upgrade catalog;

No hay comentarios: