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. python 安装 memcache

    方式一: python3 -m pip install python-memcached 方式二: pip3 install python-memcached 方式三: tar zxf python- ...

  2. HTTP 503 错误 – 服务不可用 (Service unavailable)

    介绍 因暂时超载或临时维护,您的 Web 服务器目前无法处理 HTTP 请求. 其含义是, 这是一个暂时情况,会有一些延误, 过 后将会得到缓解. 有些服务器在这种情况下也许干脆拒绝套接字(socke ...

  3. python学习-day3

    今天是第三天学习,加油! 第一部分 集合 一.集合 1.什么是集合以及特性? 特性:无序的,不重复的序列,可嵌套. 2.创建集合 方法一:创建空集合 s1 = set() print(type(s1) ...

  4. centos打开3306端口

    centos默认是关闭了3306端口的,外网通过3306端口不能访问数据库,这时需呀打开3306端口1.打开端口: /sbin/iptables -I INPUT -p tcp --dport 330 ...

  5. 浅谈Block传值-匿名函数(代码块)

    block传值是从后往前传值---代理也是 // 使用block时, 不能访问self, 也不能直接访问属性, self.属性, 用self调用方法; 只要这样做了, block都会对其强引用一份, ...

  6. ashx中session的使用

    在平常的页面上是用是很容易就的到request,response对像,从而对其进行一些操作,但在ashx(一般处理程序)中却是有一点的不同, 在ashx你无法正常的使用session,即 contex ...

  7. PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup, __toStr

    PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep ...

  8. 手机user agent大全下载 整理发布一批移动设备的user agent【分享】

    手机user agent大全下载 整理发布一批移动设备的user agent[分享] 很多人朋友在玩浏览器的时候 或者写软件的时候需要用到 user agent 这个东西 修改这个 可以使自己的浏览器 ...

  9. PHP第三节笔记

    ●为什么要安装web服务器,和怎么样去了解发送和接受到什么? 1.因为我们的浏览器要取数据,数据是从服务器取出来的. 2.我们可以通过httpwatch工具来获取发送和接收的数据,有利于我们了解的更加 ...

  10. ubuntu下安装postgres

    PostgreSQL 是一款强大的,开源的,对象关系型数据库系统.它支持所有的主流操作系统,包括 Linux.Unix(AIX.BSD.HP-UX,SGI IRIX.Mac OS.Solaris.Tr ...