千家信息网

RMAN-在恢复目录中注册和取消数据库

发表于:2024-11-24 作者:千家信息网编辑
千家信息网最后更新 2024年11月24日,创建恢复目录1、在目录数据库中创建恢复目录所用表空间SQL> create tablespace rman_ts datafile 'c:\oracle\oradata\cc\rmants.ora'
千家信息网最后更新 2024年11月24日RMAN-在恢复目录中注册和取消数据库

创建恢复目录
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 rman/rman@ping

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 sys/1@racdb

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 rman/rman@ping

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 rman/rman@ping
Connected.

2.查找表DB 中的注册记录
[oracle@node1 ~]$ rman target sys/1@racdb

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 sys/sys@ping 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>

0