使用RMAN恢复目录(catalog)解析

简介:

首先理解什么是catalog 恢复目录,实际上就是把数据库的一部分分出来作为catalog,来长时间存备份信息,在实际生产中,有时候会遇到要恢复数据库到一年或是更长时间之前的状态,我们知道控制文件存在很多重要的数据库结构信息,但是你的控制文件早已经被覆盖,你就不能完成任务,而catalog就不一样了,它可以保存很长时间,当然它也不只是可以存控制文件,也可以存别的备份副本,你可以把它简单的理解成保存时间长的控制文件,已经在控制文件清除的信息,重新加载回来。
1,创建恢复目录所有者默认表空间

SYS@ENMOEDU> create tablespace ts_catalog datafile '/u01/app/oracle/oradata/ENMOEDU/ts_catalog.dbf' size 15m; 

Tablespace created.

2,创建恢复目录所有者

SYS@ENMOEDU> create user rcower identified by oracle default tablespace ts_catalog ; 

User created.
SYS@ENMOEDU> grant connect,resource ,recovery_catalog_owner to rcower;               

Grant succeeded.

3.创建恢复目录

[oracle@ENMOEDU ~]$ rman catalog rcower/oracle@ENMOEDU             #catalog库连接到另一个目标数据库的的网络服务名(就是tnsname.ora 中开头的名字)为ENMOEDU

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:37:55 2014 

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. 

connected to recovery catalog database 

RMAN> create catalog;    #自动创建了恢复目录相关的表,

recovery catalog created
注册目标数据库            注册之后目标数据库原文件会同步到catalog  
[oracle@ENMOEDU ~]$ rman target sys/oracle@ENMOEDU catalog rcower/oracle@ENMOEDU; 

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014 

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. 

connected to target database: ENMOEDU (DBID=87396644) 
connected to recovery catalog database
RMAN> register database; 

database registered in recovery catalog 
starting full resync of recovery catalog 
full resync complete 
查看已经注册的目标库
[oracle@ENMOEDU ~]$ sqlplus rcower/oracle@ENMOEDU                     

SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 15 00:51:27 2014 

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


Connected to: 
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production 
With the Partitioning, OLAP, Data Mining and Real Application Testing options 

RCOWER@ENMOEDU> SELECT * FROM RC_DATABASE; 

DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS 
---------- ---------- ---------- -------- ----------------- --------- 
1 2 87396644 ENMOEDU 1 07-OCT-13
从恢复目录中注销目标数据库
oracle@ENMOEDU ~]$ rman target sys/oracle@ENMOEDU catalog rcower/oracle@ENMOEDU;             #目标库和catalog库可以为同一个库,但是实际上是没有意义的,因为你库打不开时,是无法使用catalog的

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014 

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. 

connected to target database: ENMOEDU (DBID=87396644) 
connected to recovery catalog database
RMAN> unregister database; 
 将其他备份副本导入到恢复目录,
oracle@ENMOEDU ~]$ rman target sys/oracle@ENMOEDU catalog rcower/oracle@ENMOEDU;   
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014 

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. 

connected to target database: ENMOEDU (DBID=87396644) 
connected to recovery catalog database
将一个文件导入恢复目录  
RMAN> catalog backuppiece                               '/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2014_08_16/o1_mf_nnndf_TAG20140816T113253_9yxn76sb_.bkp';
using target database control file instead of recovery catalog
cataloged backup piece
backup piece handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2014_08_16/o1_mf_nnndf_TAG20140816T113253_9yxn76sb_.bkp RECID=26 STAMP=855748159

如果使用了快速恢复区,可以这样一次性导入。

RMAN> catalog recovery area noprompt;
searching for all files in the recovery area
no files found to be unknown to the database
List of files in Recovery Area not managed by the database
==========================================================
File Name: /u01/app/oracle/fast_recovery_area/ENMOEDU/control02.ctl
  RMAN-07526: Reason: File is not an Oracle Managed File
number of files not managed by recovery area is 1, totaling 9.38MB

本文转自ICT时空 dbasdk博客,原文链接:使用RMAN恢复目录(catalog)解析 ,如需转载请自行联系原博主。

相关文章
|
23天前
|
编译器 Linux C语言
【CMake install目录解析】CMake 深度解析:实现精准、高效的项目构建与安装
【CMake install目录解析】CMake 深度解析:实现精准、高效的项目构建与安装
38 0
|
4月前
|
JavaScript 前端开发
nodejs实现解析chm文件列表,无需转换为PDF文件格式,在线预览chm文件以及目录,不依赖任何网页端插件
nodejs实现解析chm文件列表,无需转换为PDF文件格式,在线预览chm文件以及目录,不依赖任何网页端插件
|
2月前
|
运维 Linux Shell
文件管理大师:深入解析Linux的文件与目录操控
文件管理大师:深入解析Linux的文件与目录操控
29 1
|
8月前
|
JSON 小程序 JavaScript
微信小程序的目录解析--【浅入深出系列002】
微信小程序的目录解析--【浅入深出系列002】 这是我的CSDN 的文章 转过来,可能有些许错误。请留言
|
8月前
|
关系型数据库 MySQL PHP
PHP注册、登陆、6套主页-带Thinkphp目录解析-【白嫖项目】
PHP注册、登陆、6套主页-带Thinkphp目录解析-【白嫖项目】 CSDN 转过来的,所以格式与内容有些许错误请见谅
|
8月前
|
存储 搜索推荐 Java
Java数组:解析多维度、操作技巧与性能优化(目录篇)
Java数组:解析多维度、操作技巧与性能优化(目录篇)
106 0
|
8月前
|
JSON 小程序 JavaScript
微信小程序的目录解析--【浅入深出系列002】
微信小程序的目录解析--【浅入深出系列002】
|
10月前
|
Java
mina-statemachine源码解析-目录
mina-statemachine源码解析-目录
46 0
|
12月前
|
存储 Ubuntu Shell
嵌入式LINUX(C语言编程)家目录与根目录的解析,shell编程格式,常用命令与解释
嵌入式LINUX(C语言编程)家目录与根目录的解析,shell编程格式,常用命令与解释
101 1
|
自然语言处理 测试技术 Python
基于UIAutomation+Python+Unittest+Beautifulreport的WindowsGUI自动化测试框架common目录解析
基于UIAutomation+Python+Unittest+Beautifulreport的WindowsGUI自动化测试框架common目录解析
437 0
基于UIAutomation+Python+Unittest+Beautifulreport的WindowsGUI自动化测试框架common目录解析

推荐镜像

更多