RMAN-在恢復目錄中註冊和取消資料庫

達芬奇的夢發表於2017-03-29

建立恢復目錄
1、在目錄資料庫中建立恢復目錄所用表空間
SQL> create tablespace rman_ts datafile 'c:\oracle\oradata\cc\rmants.ora' size 20M ;
表空間已建立。

2、在目錄資料庫中建立RMAN 使用者並授權
SQL> create user rman identified by rman default tablespace rman_ts temporary tablespace temp
quota unlimited on rmants;
使用者已建立

SQL> grant recovery_catalog_owner,resource to rman;

Grant succeeded.

3、在目錄資料庫中建立恢復目錄
[oracle@node1 ~]$ rman catalog  

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 7 09:52:13 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to recovery catalog database

RMAN> create catalog tablespace rman_ts;

recovery catalog created

4、註冊目標資料庫到恢復目錄
目標資料庫:racdb
恢復目錄:ping

[oracle@node1 ~]$ rman target 

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 7 10:05:50 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: RACDB (DBID=672464192)

RMAN> connect catalog 

connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

二、取消資料庫的註冊
1.在SQLPLUS使用RMAN使用者登入恢復目錄

[oracle@node1 ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 7 10:50:06 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn   
Connected.

2.查詢表DB 中的註冊記錄
[oracle@node1 ~]$ rman target 

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 7 10:49:03 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: RACDB (DBID=672464192)

RMAN>

SQL> select db_key,db_id from db;

    DB_KEY      DB_ID
---------- ----------
         1  672464192

DBID=DB.DB_ID
## 切記一定要使用RMAN的使用者登陸,不然將出現如下錯誤提示

SQL> conn  as sysdba
Connected.
SQL> select db_key,db_id from db;
select db_key,db_id from db
                         *
ERROR at line 1:
ORA-00942: table or view does not exist


3.登出資料庫
SQL> execute dbms_rcvcat.unregisterdatabase(1,672464192);

PL/SQL procedure successfully completed.

4.驗證登出動作
[oracle@node1 ~]$ rman

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 7 11:02:16 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

RMAN> list backup;

using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 01/07/2009 11:02:21
RMAN-06171: not connected to target database

RMAN>

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2136321/,如需轉載,請註明出處,否則將追究法律責任。

相關文章