RMAN Architecture
The RMAN architecture, shown in Figure 7-3, includes a target database, repository, and Media Management Layer, as well as Server Processes, Channels, Backup Sets, and Backup Pieces. The target database is the database that is either being backed up or restored. RMAN connects to the target database using server sessions. The repository is a separate database or schema that contains the metadata about your target database, as well as all of the backup and recovery information connected with that database for maintenance purposes. It can keep track of all of the information about every backup that you perform, including all of the file information, the time of the backup, and the database incarnation (the database version) at the time of the backup. This information can all be used to restore files and recover the database by issuing very simple restore and recovery commands. All of the information needed to complete these operations is stored in the repository. This repository can be implemented in one of two ways:
■ By using control files
■ As a recovery catalog database
Control files are the default option for implementing a repository since backup information is written to control files making the recovery catalog optional. Using a control file, however, limits the functionality of RMAN, while a recovery catalog provides you with the use of all RMAN features (this option is strongly recommended). Some of the advantages that a recovery catalog gives include the following:
■ The catalog will store the physical structure of the target database, as well as backups of data files, control files, and archive logs.
■ You can store scripts of common tasks.
■ Multiple databases can be managed from one location.
■ Complete reporting capabilities
■ Access to a longer history of backups and metadata
■ Ability to perform recovery when control files are lostA complete set of options when you try to restore from previous backup sets
■ More recovery flexibility and options
One disadvantage of using an RMAN recovery is that it needs to be managed itself. However, this is a small database or schema, so maintenance is minimal. Also, one RMAN catalog can manage multiple databases. Backups can be performed easily through a hot backup or database export. You also need to keep the recovery catalog in sync with the control files, which is performed with the RMAN-provided resync command.

1、Set Up a Recovery Catalog and Target Database
Setting up a recovery catalog is a very simple process. This can be done through the Enterprise Manager GUI or through some simple commands in SQL*Plus and the RMAN command-line interface. In SQL*Plus, all you need to do is to create a tablespace to store the catalog data in, create an RMAN user, and then grant the 
recovery_catalog_owner role to the RMAN user. In RMAN, run the  create     catalogstatement:  (使用恢复目录对数据库进行备份,以sys连接到rman实例,创建数据表空间,创建rcat用户并授权)以下测试时单独新建了一个实例rman,也可以不用新建,跟目标数据库使用同一个实例。

SQL> conn sys/rman@rman as sysdba;--最好单独创建一个新的实例rman,并使用sys用户连接到rman
已连接。
SQL> create tablespace rcatts datafile 'D:\rman\rman_data\rcatts.dbf' size 1024M; 表空间已创建。 SQL> create user rcat identified by rcat temporary tablespace temp
2 default tablespace rcatts quota unlimited on rcatts; 用户已创建。 SQL> grant connect, resource, recovery_catalog_owner to rcat; 授权成功。 SQL> exit
从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开 C:\Users\Administrator>

2、In the RMAN command-line interface, log in and create the catalog:

(使用上一步创建的rcat用户登录并创建恢复目录)

C:\Users\Administrator>rman catalog=rcat/rcat@rman;

恢复管理器: Release 11.2.0.1.0 - Production on 星期二 10月 7 23:52:05 2014

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

连接到恢复目录数据库

RMAN> create catalog;

恢复目录已创建

RMAN>

3、把目标数据库注册到恢复目录catalog中

Now you need to register the target database in the catalog. To do this, connect to the target and the catalog database and then register the target database in the catalog. This can be done from either location. The target connection must have a user ID with sysdba privileges, so an Oracle password file must be created using the orapwd utility. As described in Chapter 3, you also need to create the Oracle networking configuration using tnsnames or an equivalent for both the target and recovery catalog instances:

RMAN> connect catalog rcat/rcat@rman;--连接到恢复目录数据库

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06167: 已经连接 RMAN> connect target rusky/rusky@orcl;--连接目标数据库orcl,用户为rusky,密码为rusky 连接到目标数据库: ORCL (DBID=1385990360) RMAN> register database; 注册在恢复目录中的数据库
正在启动全部恢复目录的 resync
完成全部 resync RMAN>

4、It’s now time to back up your entire database

连接恢复目录,连接目标数据库

C:\Users\Administrator>rman target rusky/rusky@orcl catalog rcat/rcat@rman;

恢复管理器: Release 11.2.0.1. - Production on 星期日 10月  :: 

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

连接到目标数据库: ORCL
连接到恢复目录数据库 RMAN>

备份数据库。

RMAN> configure default device type to disk;--可不用指定,使用默认。可使用show all 查看configure参数
RMAN> configure controlfile autobackup on;--默认值off,一般设置为on,即备份目标数据库的同时备份控件文件
RMAN> backup database plus archivelog;--备份数据库库的同时备份归档文件。如果想单独备份归档文件,可使用命令:backup archivelog all;
RMAN> exit;

5、上一步数据库已完全备份成功,可设置一个恢复的环境,如可关闭数据库并且删除所有的数据文件、归档日志、控制文件、参数文件等。

To do this, shut down the database and delete all of the data files, archive logs, control files, and the spfile SPFILEORA11G.ora for the target database.
6、恢复数据库
重新连接到恢复目录和目标数据库,并将数据库置于nomount状态。

RMAN> connect catalog rcat/rcat@rman;
RMAN> connect target rusky/rusky@orcl;
RMAN> startup nomount;
RMAN> restore archivelog all;
RMAN> restore controlfile; --resotrer控制文件、参数文件、归档日志文件只能在nomount状态。
RMAN> alter database mount;
RMAN> restore database;--restore数据文件要先mount
RMAN> recover database;
RMAN> alter database open resetlogs;

7、其它相关操作

(1) 在rman提示符下来验证成功注册的数据库。
RMAN>Report Schema;
(2) 删除恢复目录
如同可以创建恢复目录模式,你也可以删除恢复目录模式。使用drop catalog命令可以删除恢复目录模式。当删除恢复目录模式,包含在模式中的所有信息都会丢失,因此在删除模式之前应该考虑备份恢复目录模式数据库。两次drop catalog
RMAN> drop catalog;

恢复目录所有者是RMAN
再输入一次 DROP CATALOG 命令来确认目录删除

RMAN> drop catalog;

恢复目录已删除

RMAN>
(3) 恢复目录中取消数据库注册
可在RMAN中使用unregister database命令来取消数据库注册。如果希望取消已存在的数据库注册,只要连接到数据库和恢复目录,并执行unregister database命令即可:
RMAN>unregister database;

如果数据库已删除,并且希望从恢复目录中删除该数据库,则大多数情况下只需要知道希望取消注册的数据库的名称。如希望取消注册orcl数据库实例。则可连接到恢复目录执行以下命令:
RMAN>Unregister database orcl;

8、恢复目录的备份

恢复目录本身也需要做备份,恢复目录的备份只能使用exp/imp导出导入方式进行备份。

RMAN不能用于备份初始化参数文件和口令文件。

9、更新恢复目录
为了支持更新的RMAN客户端,例如RMAN恢复目录版本是10g,而新的RMAN客户端是11G,使用upgrade catalog命令更新本地包和模式,与drop catalog一样,需要连接到恢复目录,但是无需连接到目标数据库:
RMAN> upgrade catalog;

恢复目录所有者是RCAT
再输入一次 UPGRADE CATALOG 命令来确认目录升级

RMAN> upgrade catalog;

恢复目录已升级到版本11.02.00.01
DBMS_RCVMAN 程序包升级为 11.02.00.01 版
DBMS_RCVCAT 程序包升级为 11.02.00.01 版

RMAN>

==============RMAN-catalog和nocatalog的区别====================================

注意,当使用rman nocatalog恢复时,数据库必须是处于“mount”状态的。而Oracle startup mount的前提条件是control必须存在。因此,你必须在恢复datafile之前先恢复controlfile。 使用rman catalog方式时,可以startup nomount然后restore controlfile;但使用rman nocatalog时,必须先用文件方式恢复controlfile。

下面对比一下rman nocatalog和rman catalog的恢复时的步骤,以便建立正确的备份策略(以下的恢复都是在online状态下的备份):
rman nocatalog恢复:
1) 建立oracle运行环境(包括init或sp文件)
2) 文件方式恢复controlfile到init文件指定的位置
3) startup mount
4) rman,恢复datafile
5) alter database open resetlogs

rman catalog恢复:
1) 建立oracle运行环境(包括init或sp文件)
2) rman ,restore controfile
3) alter database mount
4) rman, restore datafile
5) alter database open resetlogs

可以看出,rman nocatalog备份时,必须用文件方式备份controlfile。

==================

Report schema              Report shema是指在数据库中查找schema

List backup                   从control读取信息

Crosscheck backup       看一下backup的文件,检查controlfile中的目录或文件是否真正在磁盘上

Delete backupset 24      24代表backupset 的编号, 既delete目录,也delete你的文件

=====================

The purpose of the RMAN recovery catalog:
A recovery catalog is a database schema used by RMAN to store metadata about one or more Oracle databases. Typically, you store the catalog in a dedicated database. A recovery catalog provides the following benefits:
A recovery catalog creates redundancy for the RMAN repository stored in the control file of each target database. The recovery catalog serves as a secondary metadata repository. If the target control file and all backups are lost, then the RMAN metadata still exists in the recovery catalog.
A recovery catalog centralizes metadata for all your target databases. Storing the metadata in a single place makes reporting and administration tasks easier to perform.
A recovery catalog can store metadata history much longer than the control file. This capability is useful if you must do a recovery that goes further back in time
than the history in the control file. The added complexity of managing a recovery catalog database can be offset by the convenience of having the extended backup
history available.
Some RMAN features function only when you use a recovery catalog. For example, you can store RMAN scripts in a recovery catalog. The chief advantage of a stored script is that it is available to any RMAN client that can connect to the target database and recovery catalog. Command files are only available if the RMAN client has access to the file system on which they are stored.
A recovery catalog is required when you use RMAN in a Data Guard environment. By storing backup metadata for all primary and standby databases, the catalog enables you to offload backup tasks to one standby database while enabling you to restore backups on other databases in the environment.

======FROM=======

http://blog.csdn.net/tianlesoftware/article/details/5641763

[oracle数据库11G初学者指南].Oracle.Database.11g,.A.Beginner's.Guide

RMAN-使用catalog恢复目录进行备份与恢复的更多相关文章

  1. Oracle之catalog恢复目录的创建于维护(51CTO风哥rman课程)

    catalog恢复目录配置过程 1,创建一个表空间 2,创建rman用户并授权 3,创建恢复目录 4,配置TNS 5,注册数据库 6,检查 创建ramn表空间 首先查看一下其他表空间位置 create ...

  2. RMAN_学习笔记3_RMAN Catalog恢复目录

    2014-12-23 Created By BaoXinjian

  3. rman catalog (rman 恢复目录)

    受控制文件大小的限制,一般rman需要用rman catalog来管理及存放备份信息: 这里介绍一下创建rman catalog的步骤: C:\Documents andSettings\Admini ...

  4. OCP读书笔记(3) - 使用RMAN恢复目录

    创建恢复目录 在hndx上创建恢复目录:[oracle@oracle admin]$ export ORACLE_SID=hndx[oracle@oracle admin]$ sqlplus / as ...

  5. RMAN 还原与恢复

    一. RMAN 还原与恢复基础 在RMAN 用于中,还原与恢复是两个不同的概念.还原(restore):指访问先前生成的备份,从中得到一个或多个对象,然后在磁盘上的某个位置还原这些对象.恢复(reco ...

  6. RMAN恢复目录

    是否使用RMAN恢复目录(Recovery Catalog 你可能从其他人或书上听过RMAN恢复目录(也有可能是其他名字,RMAN Recovery Catalog的翻译较多较杂,以下简称恢复目录), ...

  7. RMAN_学习笔记5_RMAN Catalog Script恢复目录脚本

    2014-12-24 Created By BaoXinjian

  8. rman全库恢复到不同主机,不同实例名,不同目录下

    一.配置目标主机的ip.hostname及与源端主机的连通性 1.配置目标主机IP 使用图形界面配置IP: administration----network---修改IP(指定静态IP) deact ...

  9. Oracle DB 使用RMAN恢复目录

    • 对恢复目录和RMAN 资料档案库控制文件的使用进行比较• 创建和配置恢复目录• 在恢复目录中注册数据库• 同步恢复目录• 使用RMAN 存储脚本• 备份恢复目录• 创建虚拟专用目录 RMAN 资料 ...

随机推荐

  1. windows下删除服务的方法

    删除的办法有两个: 办法一: 用sc.exe这个Windows命令 开始——运行——cmd.exe,然后输入sc就可以看到了.使用办法很简单: sc delete "服务名" (如 ...

  2. ORA-24324、ORA-12560、ORA-12514

    SQL> startup ERROR: ORA-24324: 未初始化服务句柄 ORA-01041: 内部错误, hostdef 扩展名不存在. SQL> conn sys /nolog; ...

  3. IE6,IE7下滚动条没有生效解决方法

    需要加个相对定位 position:relative;

  4. web.config中的profile

    aspnet_regsql命令创建需要的表结构 public class UserProfile:ProfileBase { [SettingsAllowAnonymous(true)] //默认匿名 ...

  5. SqlBulkCopy的一个例子

    public bool InsertAll(IList<NewStockLuoPan> list) { DataTable dt = new DataTable(); dt.Columns ...

  6. 技术路线 vs 技术管理路线

    最近因为要给刚毕业的学生做一次演讲,所以就职业发展这类话题先以写博客的形式做一些思考,希望届时能给同学们带来质量更高的内容.我在<驾驭你的"职场布朗运动">一文中谈了2 ...

  7. arc engine - IName

    IName对象是一个代表性对象.通过使用IName对象,可以访问它所代表的对象的一些基本属性,而不用将整个对象调入内存.我们用IWorkspace 获得一个Workspace,那可是会调入内存的,而I ...

  8. BZOJ 2243 SDOI 2011染色

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2243 算法讨论: 树链剖分把树放到线段树上.然后线段树的每个节点要维护的东西有左端点的颜色 ...

  9. SpringSource Tools Suite 字体偏小问题

    参照了Eclipse小技巧收录http://liuzidong.iteye.com/blog/1320094 发现没有找到相应文件,只有搜索了,一个一个地找,总算找到了,修改方法还是一样,只是路径,文 ...

  10. php,apache伪静态(1转)

    1.检测Apache是否支持mod_rewrite通过php提供的phpinfo()函数查看环境配置,通过Ctrl+F查找到“Loaded Modules”,其中列出了所有apache2handler ...