恢复目录的创建与删除

oracle 9i版本

一、创建恢复目录

1、新建一个数据库testcat,作为恢复目录的数据库;

2、CREATE TABLESPACE RMAN_TS;

SQL>CREATE TABLESPACE "RMAN_TS" DATAFILE '...' SIZE 100M AUTOEXTEND

2>  ON NEXT 10M UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

3、创建用户 rman_db/rman_db,作为恢复目录的用户

SQL> CREATE USER rman_db IDENTIFIED BY rman_db

2>   DEFAULT TABLESPACE RMAN_TS

3>   QUOTA UNLIMITED ON RMAN_TS;

3、Grant privileges

SQL> grant connect,resource to rman_db;

SQL> grant recovery_catalog_owner to rman_db;

4、Create catalog

> rman catalog rman_db / rman_db @testcat;

rman>create catalog  tablespace rman_ts;

5、register target database

> rman target /  catalog rman_db / rman_db @testcat;

rman> register database;

经过以上5步的操作之后,数据库已成功在恢复目录中注册。

二、删除恢复目录

1、连接sqlplus

Sql> conn rman_db / rman_db @testcat;

Sql> select db_key ,db_id from db;

 DB_KEY              DB_ID

------------------------------------

 1                 2920390016

Sql> dbms_rcvcat.unregisterdatabase(1,2920390016);

PL/SQL执行成功

2、Drop catalog

> Rman target /   catalog rman_db / rman_db @testcat;

Rman> drop catalog;

此后会提示你,再次输入drop catalog 已确认是否删除。

注:一旦删除恢复目录,则之前在恢复目录中的备份记录就会丢掉,所以要慎重。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10037372/viewspace-663234/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10037372/viewspace-663234/

你可能感兴趣的:(恢复目录的创建与删除)