ITPub博客

首页 > 数据库 > Oracle > ORACLE 11g RMAN备份恢复--catalog

ORACLE 11g RMAN备份恢复--catalog

原创 Oracle 作者:warren20 时间:2015-03-08 21:55:28 0 删除 编辑

    rman catalog是为数据备份恢复时,使用恢复目录catalog,与nocatalog的不同是,nocatalog将备份相关的信息记录在了控制文件中,而catalog将备份信息记录在了恢复目录中。

本文做的实验是将恢复目录创建在oracle 12c上,需要备份的数据库在oracle 11g上。

STEP1:在恢复目录catalog数据库上创建专门用于恢复的的用户rman

  1. --创建恢复目录的表空间
  2. SQL> create tablespace TBS_RMAN datafile '/u01/app/oradata/rman1.dbf' size 5M autoextend on next 2M;
  3.   
  4. Tablespace created.
  5.   
  6. --创建用户
  7. SQL> create user rman identified by rman default tablespace tbs_rman temporary tablespace TEMP;
  8.   
  9. User created.
  10.   
  11. --对用户rman赋权
  12. SQL> grant connect,resource,recovery_catalog_owner to rman;
  13.   
  14. Grant succeeded.


创建用户后,用rman登录PL/SQL,由于没有对rman用户赋予任何对象权限,所以没有任何对象


STEP2:连接rman的target 和catalog

  1. [oracle@REDHAT6 ~]$ rman target sys/oracle catalog rman/rman
  2. -- 或者使用下面的方式登录
  3. [oracle@REDHAT6 ~]$ rman
  4.   
  5. Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jan 28 00:27:14 2015
  6.   
  7. Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
  8.   
  9. RMAN> connect target sys/oracle;
  10.   
  11. connected to target database: ORCL (DBID=1396675707)
  12.   
  13. RMAN> connect catalog rman/rman;
  14.   
  15. connected to recovery catalog database
  16.   
  17. RMAN>


STEP3:创建恢复目录,在恢复目录下面会自动创建相关的对象
  1. RMAN> create catalog tablespace TBS_RMAN;
  2.   
  3. recovery catalog created

执行上述命令后,就会看到 rman用户下面多了许多对象(table, view等)



STEP4:恢复目录已经创建了, 需要将 target 和 catalog关联起来,即注册服务器(注册服务器之前 DB表是空的,注册后DB表中有数据)

  1. RMAN> register database;
  2.   
  3. database registered in recovery catalog
  4. starting full resync of recovery catalog
  5. full resync complete
注册完毕后,可以看看相关表中有数据了,下图是db表中的数据
  1. SQL> select * from db;
  2.   
  3.     DB_KEY DB_ID CURR_DBINC_KEY
  4. ---------- ---------- --------------
  5.      1 1396675707 2


OK, catalog恢复目录已经创建完毕

本实验,如果数据库shutdown(或数据库处于nomount, mount状态),都将不能查看备份相关的信息,因为恢复目录catalog与目标库target在同一个实例上,数据库没有打开,所以无法获取相关的信息。

如果有两台机器,target是一台机器,catalog是一台机器,target目标库停掉,也能连接catalog 。


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

请登录后发表评论 登录
全部评论

注册时间:2015-03-03

  • 博文量
    56
  • 访问量
    376704