转载请注明出处。
一.catalog 库:
二.建立catalog 数据库:
3.从恢复目录(recovery catalog)中注销目标数据库:(在目标库上操作)
三.RMAN存储脚本:
1.存放脚本:(在生产库上执行)
2.在catalog database 上查看脚本信息:
3.在生产库上查看、执行、修改、删除脚本:
四.将其他备份文件列入目录:
For example, assume that a group of directories /disk1/backups
, /disk1/backups-year2003
, /disk1/backupsets
, and /disk1/backupsets/test
and
so on, all contain backup files. The following command catalogs all files in all of these directories, because /disk1/backups
is a prefix for the paths for all of these directories:
CATALOG START WITH ‘/disk1/backups‘;
To catalog only backups in the /disk1/backups
directory, the correct command would be as follows:
CATALOG START WITH ‘/disk1/backups/‘;
五.重新同步恢复目录(Resynchronizing the Recovery Catalog)
六.备份 恢复目录(recovery catalog)
七.重新创建无法恢复的recovery catalog
八.升级和删除 recovery catalog
To upgrade the recovery catalog:
-
If you created the recovery catalog owner in a release before 10gR1, and if the
RECOVERY_CATALOG_OWNER
role did not include theCREATE TYPE
privilege, then grant it.For example, start SQL*Plus and connect to the recovery catalog database with administrator privileges. You can then execute the following
GRANT
statement:SQL> GRANT CREATE TYPE TO rman; SQL> EXIT;
-
Start RMAN and connect RMAN to the recovery catalog database.
-
Run the
UPGRADE
CATALOG
command:RMAN> UPGRADE CATALOG; recovery catalog owner is rman enter UPGRADE CATALOG command again to confirm catalog upgrade
-
Run the
UPDATE
CATALOG
command again to confirm:RMAN> UPGRADE CATALOG; recovery catalog upgraded to version 11.01.00 DBMS_RCVMAN package upgraded to version 11.01.00 DBMS_RCVCAT package upgraded to version 11.01.00
九. IMPORT CATALOG
例:To import a recovery catalog:
-
Start RMAN and connect as
CATALOG
to the destination recovery catalog schema. For example:% rman RMAN> CONNECT CATALOG 111cat@destdb;
-
Import the source recovery catalog schema, specifying the connection string for the source catalog.
For example, enter the following command to import the catalog owned by
102cat
on databasesrcdb
:IMPORT CATALOG 102cat@srcdb;
A variation is to import metadata for a subset of the target databases registered in the source catalog. You can specify the databases by DBID or database name, as shown in the following examples:
IMPORT CATALOG 102cat@srcdb DBID=1423241, 1423242; IMPORT CATALOG 102cat@srcdb DB_NAME=prod3, prod4;
-
Optionally, connect to a target database to check that the metadata was successfully imported. For example, the following commands connect to database
prod1
asTARGET
and list all backups for this database:LIST BACKUP;
十. virtual private catalog
The basic steps for creating a virtual private catalog are as follows:
-
Create the database user who will own the virtual private catalog (if this user does not exist) and grant this user access privileges.
This task is described in "Creating and Granting Privileges to a Virtual Private Catalog Owner".
-
Create the virtual private catalog.
This task is described in "Creating a Virtual Private Catalog".
Creating and Granting Privileges to a Virtual Private Catalog Owner
This section assumes that you created the base recovery catalog.
Assume that the following databases are registered in the base recovery catalog: prod1
, prod2
, and prod3
. The database user
who owns the base recovery catalog is catowner
. You want to create database user vpc1
and grant this user access privileges only to prod1
and prod2
.
By default, a virtual private catalog owner has no access to the base recovery catalog.
To create and grant privileges to a virtual private catalog owner:
-
Start SQL*Plus and connect to the recovery catalog database with administrator privileges.
-
If the user that will own the virtual private catalog does not exist, then create the user.
For example, if you want to create database user
vpc1
to own the catalog, then you could execute the following command (replacing password with a user-defined password):SQL> CREATE USER vpc1 IDENTIFIED BY password 2 DEFAULT TABLESPACE vpcusers 3 QUOTA UNLIMITED ON vpcusers;
Note:
Create a password that is secure. See Oracle Database Security Guide for more information. -
Grant the
RECOVERY_CATALOG_OWNER
role to the database user that will own the virtual private catalog, and then exit SQL*Plus.The following example grants the role to user
vpc1
:SQL> GRANT recovery_catalog_owner TO vpc1; SQL> EXIT;
-
Start RMAN and connect to the recovery catalog database as the base recovery catalog owner (not the virtual private catalog owner).
The following example connects to the base recovery catalog as
catowner
:% rman RMAN> CONNECT CATALOG catowner@catdb; recovery catalog database Password: password connected to recovery catalog database
-
Grant desired privileges to the virtual private catalog owner.
The following example gives user
vpc1
access to the metadata forprod1
andprod2
(but notprod3
):RMAN> GRANT CATALOG FOR DATABASE prod1 TO vpc1; RMAN> GRANT CATALOG FOR DATABASE prod2 TO vpc1;
You can also use a DBID rather than a database name. The virtual private catalog user does not have access to the metadata for any other databases registered in the recovery catalog.
You can also grant the user the ability to register new target databases in the recovery catalog. For example:
RMAN> GRANT REGISTER DATABASE TO vpc1;
Creating a Virtual Private Catalog
This section assumes that the virtual private catalog owner has been given the RECOVERY_CATALOG_OWNER
database role. Also, the base recovery catalog owner used the GRANT
command
to give the virtual private catalog owner access to metadata in the base recovery catalog.
To create a virtual private catalog:
-
Start RMAN and connect to the recovery catalog database as the virtual private catalog owner (not the base recovery catalog owner).
The following example connects to the recovery catalog as
vpc1
:% rman RMAN> CONNECT CATALOG vpc1@catdb;
-
Create the virtual private catalog.
The following command creates the virtual private catalog:
RMAN> CREATE VIRTUAL CATALOG;
-
If you intend to use a 10.2 or earlier release of RMAN with this virtual private catalog, then execute the following PL/SQL procedure (wherebase_catalog_owner is the database user who owns the base recovery catalog):
SQL> EXECUTE base_catalog_owner.DBMS_RCVCAT.CREATE_VIRTUAL_CATALOG;
Revoking Privileges from a Virtual Private Catalog Owner
This section assumes that you have created a virtual private catalog.
Assume that two databases are registered in the base recovery catalog: prod1
and prod2
. As owner of the base recovery catalog, you have granted the vpc1
user
access privileges to prod1
. You have also granted this user the right to register databases in his virtual private catalog. Now you want to revoke privileges from vpc1
.
To revoke privileges from a virtual private catalog owner:
-
Start RMAN and connect to the recovery catalog database as the recovery catalog owner (not the virtual private catalog owner).
The following example connects to the recovery catalog as
catowner
:% rman RMAN> CONNECT CATALOG catowner@catdb;
-
Revoke specified privileges from the virtual private catalog owner.
The following command revokes access to the metadata for
prod1
from virtual private catalog ownervpc1
:REVOKE CATALOG FOR DATABASE prod1 FROM vpc1;
You can also specify a DBID rather than a database name. The catalog
vpc1
retains all other granted catalog privileges.You can also revoke the privilege to register new target databases in the recovery catalog. For example:
REVOKE REGISTER DATABASE FROM vpc1;
Dropping a Virtual Private Catalog
This section assumes that you have created a virtual private catalog and now want to drop it. When you drop a virtual private catalog, you do not remove the base recovery catalog itself, but only drop the synonyms and views that refer to the base recovery catalog.
To drop a virtual private catalog:
-
Start RMAN and connect to the recovery catalog database as the virtual private catalog owner (not the base recovery catalog owner).
The following example connects to the recovery catalog as user
vpc1
:% rman RMAN> CONNECT CATALOG vpc1@catdb;
-
Drop the catalog.
If you are using an Oracle Database 11g or later RMAN executable, then drop the virtual private catalog with the
DROP CATALOG
command:RMAN> DROP CATALOG;
If you are using an Oracle Database 10g or earlier RMAN executable, then you cannot use the
DROP CATALOG
command. Instead, connect SQL*Plus to the catalog database as the virtual private catalog user, then execute the following PL/SQL procedure (where base_catalog_owner is the database user who owns the base recovery catalog):SQL> EXECUTE base_catalog_owner.DBMS_RCVCAT.DELETE_VIRTUAL_CATALOG;