欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

rman恢复目录中注销(unregister)目标数据库

程序员文章站 2024-01-01 14:09:52
...

如果不再需要使用rman来管理目标数据库,或者目标数据库已经崩溃,可以从rman恢复目录注销掉目标数据库。这样只会从恢复目录中移除目标数据库备份相关的元数据,物理备份不会被删除。 连接目标数据库 最简单的就是连上目标数据库和恢复目录,然后执行unregiste


如果不再需要使用rman来管理目标数据库,或者目标数据库已经崩溃,可以从rman恢复目录注销掉目标数据库。这样只会从恢复目录中移除目标数据库备份相关的元数据,物理备份不会被删除。

连接目标数据库

最简单的就是连上目标数据库和恢复目录,然后执行unregister database

$ rman target user/passwd@tgt catalog user/passwd@catlog;
RMAN> unregister database;
database name is "orcl" and DBID is 1276927241
Do you really want to unregister the database (enter YES or NO)? 

不连接目标数据库

如果目标数据库已经崩溃,无法再连接时,可以通过指定目标数据库的DBID或者直接使用名字来注销数据库。

如果不知道目标数据库的DBID或名字,先通过rman数据库的rc_database视图(rc指recovery catalog)来查询相关信息。谨记rman恢复目录可以同时为多个目标数据库提供服务。

$ sqlplus user/passwd@catlog;
SQL> select * from rc_database;
    DB_KEY  DBINC_KEY       DBID NAME     RESETLOGS_CHANGE# RESETLOGS_TIME
---------- ---------- ---------- -------- ----------------- ------------------
     10161      41305 1276927241 ORCL            1981608693 28-JUL-12

使用DBID

$ rman catalog user/passwd@catlog;
RMAN> set dbid=1276927241;
executing command: SET DBID
database name is "ORCL" and DBID is 1276927241
RMAN> unregister database;
database name is "ORCL" and DBID is 1276927241
Do you really want to unregister the database (enter YES or NO)? 

直接使用目标数据库名字

$ rman catalog user/passwd@catlog;
RMAN> unregister database orcl;
database name is "ORCL" and DBID is 1276927241
Do you really want to unregister the database (enter YES or NO)? YES
database unregistered from the recovery catalog

移除恢复目录

如果rman恢复目录不再使用,可以drop掉:

$ rman catalog user/passwd@catlog;
RMAN> drop catalog;

References:
[1]Remove a Database from a RMAN Recovery Catalog

===
每个人都受两种教育,一种来自别人,另一种更重要的是来自自己。 —— 爱德华·吉本

上一篇:

下一篇: