之前整理的RMAN 有关还原的文章:

RMAN 系列(五) ---- RMAN 还原 与 恢复

http://blog.csdn.net/tianlesoftware/archive/2010/07/11/5700474.aspx

RMAN 备份与恢复 实例

http://blog.csdn.net/tianlesoftware/archive/2009/10/20/4699320.aspx

Oracle Rman跨resetlogs版本恢复

http://blog.csdn.net/tianlesoftware/archive/2009/10/17/4682463.aspx

RAC 下的RMAN 讲究的是备份和还原的策略要一致。备份策略的不同,会导致备份结果的分步不同,进而影响恢复的策略和步骤。一般情况下,恢复策略和备份策略必须是对应的。如果备份策略进行了修改,那么恢复也应该采用相同的策略。之前我们的RMAN 备份参考:

RAC 之 RMAN 备份

http://blog.csdn.net/tianlesoftware/archive/2010/09/22/5901053.aspx

这里面有2个注意事项:

  1. 执行恢复的节点要能看到所有节点的归档文件。 这个在RAC 备份那篇里已经讲了方法,就是把归档文件传送到其他节点,这样就能够看到所有节点的归档文件了。
  2. 备份集的存放问题。 如果我们放在共享设备上,那么节点可以访问所有的备份文件,那么就可以直接进行恢复操作。 如果不是放在共享设备,可以通过NFS mount来挂载,或者设置2个通道。 分别指向多个实例。

示例:

1.1 先停止数据库

[oracle@rac1 bin]$ srvctl stop db -d orcl

[oracle@rac1 bin]$ crs_stat -t

Name           Type           Target    State     Host

------------------------------------------------------------

ora.orcl.db    application    OFFLINE   OFFLINE

ora....oltp.cs application    OFFLINE   OFFLINE

ora....cl1.srv application    OFFLINE   OFFLINE

ora....cl2.srv application    OFFLINE   OFFLINE

ora....l1.inst application    OFFLINE   OFFLINE

ora....l2.inst application    OFFLINE   OFFLINE

ora....SM1.asm application    ONLINE    ONLINE    rac1

ora....C1.lsnr application    ONLINE    ONLINE    rac1

ora.rac1.gsd   application    ONLINE    ONLINE    rac1

ora.rac1.ons   application    ONLINE    ONLINE    rac1

ora.rac1.vip   application    ONLINE    ONLINE    rac1

ora....SM2.asm application    ONLINE    ONLINE    rac2

ora....C2.lsnr application    ONLINE    ONLINE    rac2

ora.rac2.gsd   application    ONLINE    ONLINE    rac2

ora.rac2.ons   application    ONLINE    ONLINE    rac2

ora.rac2.vip   application    ONLINE    ONLINE    rac2

1.2 将节点启动到mount 状态:

备份集存在在2个节点的情况(2个节点的RAC),在这种情况下,需要分配2个通道分别连接对应的节点。 每个节点都需要启动到mount状态。 因为每个节点都有备份文件,所以在每个节点都需要执行restore,如果没有启动的话,就会报错,对于备份集存放在共享设备的就不用这么麻烦。

[oracle@rac1 bin]$ export ORACLE_SID=orcl1

[oracle@rac1 bin]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Sep 27 02:56:55 2010

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

connected to target database (not started)

RMAN> startup mount;

Oracle instance started

database mounted

Total System Global Area     180355072 bytes

Fixed Size                     1218388 bytes

Variable Size                100665516 bytes

Database Buffers              75497472 bytes

Redo Buffers                   2973696 bytes

[oracle@rac2 bin]$ export ORACLE_SID=orcl2

[oracle@rac2 bin]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Sep 27 02:57:44 2010

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

connected to target database (not started)

RMAN> startup mount;

Oracle instance started

database mounted

Total System Global Area     180355072 bytes

Fixed Size                     1218388 bytes

Variable Size                 83888300 bytes

Database Buffers              92274688 bytes

Redo Buffers                   2973696 bytes

1.3            完全恢复

在任意一个节点上执行:

RMAN> RUN {

allocate channel c1 device type disk connect  'sys/oracle@orcl1';

allocate channel c2 device type disk connect  'sys/oracle@orcl2';

restore database;

recover database;

}

2> 3> 4> 5> 6>

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=146 instance=orcl1 devtype=DISK

allocated channel: c2

channel c2: sid=146 instance=orcl2 devtype=DISK

Starting restore at 27-SEP-10

skipping datafile 2; already restored to file +DATA/orcl/datafile/undotbs1.278.730181053

skipping datafile 3; already restored to file +DATA/orcl/datafile/sysaux.277.730181053

skipping datafile 5; already restored to file +DATA/orcl/datafile/undotbs2.284.730181347

skipping datafile 1; already restored to file +DATA/orcl/datafile/system.276.730181051

skipping datafile 4; already restored to file +DATA/orcl/datafile/users.279.730181053

skipping datafile 7; already restored to file +DATA/orcl/datafile/anhuianqing.dbf

Finished restore at 27-SEP-10

Starting recover at 27-SEP-10

starting media recovery

media recovery complete, elapsed time: 00:00:04

Finished recover at 27-SEP-10

released channel: c1

released channel: c2

RMAN> sql 'alter database open';

sql statement: alter database open

1.4 不完全恢复

1.4.1基于时间点的恢复

RMAN> RUN {

allocate channel c1 device type disk connect  'sys/oracle@orcl1';

allocate channel c2 device type disk connect  'sys/oracle@orcl2';

set until time "to_date('2010/9/27 03:30:00','yyyy/mm/dd hh24:mi:ss')";

restore database;

recover database;

}

2> 3> 4> 5> 6> 7> 8>

allocated channel: c1

channel c1: sid=143 instance=orcl1 devtype=DISK

allocated channel: c2

channel c2: sid=146 instance=orcl2 devtype=DISK

executing command: SET until clause

Starting restore at 27-SEP-10

channel c1: starting datafile backupset restore

channel c1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to +DATA/orcl/datafile/system.276.730181051

restoring datafile 00004 to +DATA/orcl/datafile/users.279.730181053

restoring datafile 00007 to +DATA/orcl/datafile/anhuianqing.dbf

channel c1: reading from backup piece /u01/backup/orcl_2blotmnp_1_1_20100927

channel c2: starting datafile backupset restore   -- 这里使用了2个通道,因为这个测试的备份集是放在2个节点的。

channel c2: specifying datafile(s) to restore from backup set

restoring datafile 00002 to +DATA/orcl/datafile/undotbs1.278.730181053

restoring datafile 00003 to +DATA/orcl/datafile/sysaux.277.730181053

restoring datafile 00005 to +DATA/orcl/datafile/undotbs2.284.730181347

channel c2: reading from backup piece /u01/backup/orcl_2clotmno_1_1_20100927

channel c2: restored backup piece 1

piece handle=/u01/backup/orcl_2clotmno_1_1_20100927 tag=ORCL_HOT_DB_BK

channel c2: restore complete, elapsed time: 00:01:21

channel c1: restored backup piece 1

piece handle=/u01/backup/orcl_2blotmnp_1_1_20100927 tag=ORCL_HOT_DB_BK

channel c1: restore complete, elapsed time: 00:02:48

Finished restore at 27-SEP-10

Starting recover at 27-SEP-10

starting media recovery

media recovery complete, elapsed time: 00:00:03

Finished recover at 27-SEP-10

released channel: c1

released channel: c2

RMAN>

恢复完成之后,在两个节点执行:

alter database open resetlogs;

打开数据即可。

1.4.2 基于SCN的恢复

当前SCN 查看方法:

SQL> select current_scn from v$database;

CURRENT_SCN

-----------

1118216

RMAN> RUN {

allocate channel c1 device type disk connect  'sys/oracle@orcl1';

allocate channel c2 device type disk connect  'sys/oracle@orcl2';

restore database until scn 1118215 ;

recover database until scn 1118215 ;

}

2> 3> 4> 5> 6>

using target database control file instead of recovery catalog  -- 非catalog 模式, 这种模式备份控制文件非常重要

allocated channel: c1

channel c1: sid=142 instance=orcl1 devtype=DISK

allocated channel: c2

channel c2: sid=151 instance=orcl2 devtype=DISK

Starting restore at 27-SEP-10

channel c1: starting datafile backupset restore

channel c1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to +DATA/orcl/datafile/system.276.730181051

restoring datafile 00004 to +DATA/orcl/datafile/users.279.730181053

restoring datafile 00007 to +DATA/orcl/datafile/anhuianqing.dbf

channel c1: reading from backup piece /u01/backup/orcl_2blotmnp_1_1_20100927

channel c2: starting datafile backupset restore

channel c2: specifying datafile(s) to restore from backup set

restoring datafile 00002 to +DATA/orcl/datafile/undotbs1.278.730181053

restoring datafile 00003 to +DATA/orcl/datafile/sysaux.277.730181053

restoring datafile 00005 to +DATA/orcl/datafile/undotbs2.284.730181347

channel c2: reading from backup piece /u01/backup/orcl_2clotmno_1_1_20100927

channel c2: restored backup piece 1

piece handle=/u01/backup/orcl_2clotmno_1_1_20100927 tag=ORCL_HOT_DB_BK

channel c2: restore complete, elapsed time: 00:03:58

channel c1: restored backup piece 1

piece handle=/u01/backup/orcl_2blotmnp_1_1_20100927 tag=ORCL_HOT_DB_BK

channel c1: restore complete, elapsed time: 00:05:47

Finished restore at 27-SEP-10

Starting recover at 27-SEP-10

starting media recovery

archive log thread 1 sequence 44 is already on disk as file /u02/rac1_arch/1_44_730181171.dbf

archive log thread 2 sequence 38 is already on disk as file /u02/rac1_arch/2_38_730181171.dbf

archive log thread 1 sequence 1 is already on disk as file /u02/rac1_arch/1_1_730784806.dbf

archive log thread 2 sequence 1 is already on disk as file /u02/rac2_arch/2_1_730784806.dbf

archive log filename=/u02/rac1_arch/1_44_730181171.dbf thread=1 sequence=44

archive log filename=/u02/rac1_arch/2_38_730181171.dbf thread=2 sequence=38

archive log filename=/u02/rac2_arch/2_1_730784806.dbf thread=2 sequence=1

media recovery complete, elapsed time: 00:00:09

Finished recover at 27-SEP-10

released channel: c1

released channel: c2

恢复结束,用 alter database open resetlogs 打开数据库。

小结:

以上都是简单的测试,具体情况还是要具体对待。 经验积累的多了,就知道怎么处理了。 总之,备份重于一切。 有了备份,才有恢复的可能。

--本篇文章转自:http://blog.csdn.net/tianlesoftware/article/details/5909912

RAC之RMAN恢复的更多相关文章

  1. RAC 之 RMAN 恢复

    RAC 下的RMAN 讲究的是备份和还原的策略要一致.备份策略的不同,会导致备份结果的分步不同,进而影响恢复的策略和步骤.一般情况下,恢复策略和备份策略必须是对应的.如果备份策略进行了修改,那么恢复也 ...

  2. 12c RAC 用Rman 恢复到异机单实例

    准备工作 原服务器软件部署:Redhat 6.6 + Oracle 12.2.0.1 rac Oracle12c单实例安装 1.创建恢复服务器,设置大于原库数据大小的磁盘容量.设置相同的服务器主机名参 ...

  3. RAC+asm通过rman恢复到单实例+asm

    1.恢复参数文件,并修改参数文件 参数文件指名几个最简单的就行,我的参数文件如下: 2.恢复控制文件,并启动数据库到mount 如果是把备份集从别的服务器拷贝到本地恢复的服务器的目录,使用下面的语句指 ...

  4. RAC异机恢复

    RAC异机恢复PDCL到PFCL: PNCL:RAC+ASM ,product env   db name:PNCL   instance:PDCL1 PDCL2 PFCL:RAC+ASM ,perf ...

  5. 【RAC】将RAC备份集恢复为单实例数据库

    [RAC]将RAC备份集恢复为单实例数据库 一.1  BLOG文档结构图 一.2  前言部分 一.2.1  导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识, ...

  6. oracle rman恢复数据库 方式恢复到异地数据库

    目的:从某个环境中,获取相关文件,放到异地机器使用rman 恢复.   情况说明:XX系统使用的是oracle数据库,现已从服务器拉下来相关文件,依靠这些文件来早本地的测试机上恢复数据库,方便进行数据 ...

  7. Oracle RMAN 恢复控制文件到指定的路径

    Oracle 数据库通过RMAN恢复控制文件到指定的路径 --------------------------------------------------------- 先查询备份集信息,再指定备 ...

  8. RMAN恢复目录

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

  9. rman恢复误删除的一张表(不完全恢复)

    恢复误删除的一张表可以使用很多方法,如日志挖掘.闪回等,rman恢复(不完全恢复)肯定不是最好的,也不建议用, 现在我们只是演示一下这种恢复. 1 RMAN备份数据库 2创建测试表 3查看此时的SCN ...

随机推荐

  1. LeetCode_Unique Paths

    A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The ...

  2. TEncoding & TNetEncoding(使用现成的TBase64Encoding,TEncoding和TMBCSEncoding)

    TEncoding and TNetEncoding are abstract classes and you will never instantiate one of them, because ...

  3. TranslateAnimation详解

    TranslateAnimation详解 Android JDK为我们提供了4种动画效果,分别是: AlphaAnimation,RotateAnimation, ScaleAnimation, Tr ...

  4. 针对portmap 的DDOS攻击

    iptables -I INPUT -p tcp --dport 111 -j DROP iptables -I INPUT -s 10.171.254.221 -p tcp --dport 111 ...

  5. 基本SQL练习题--选课经典例题

    为管理岗位业务培训信息,建立3个表: S (S#,SN,SD,SA) S#,SN,SD,SA 分别代表学号.学员姓名.所属单位.学员年龄 C (C#,CN ) C#,CN 分别代表课程编号.课程名称 ...

  6. (转)iOS7界面设计规范(11) - UI基础 - 图标与图形

    不知别人如何,我自己来讲,平时很习惯很有动力去做的一些事,譬如博客吧,一旦生活中出现一些让自己很难受的状况,就很容易受到影响:像是,你平时所习惯的生活状态都是基于某种东西的,一旦这种东西崩塌,会影响到 ...

  7. android layout属性介绍

    android:id 为控件指定对应的ID android:text 指定控件其中显示的文字,须要注意的是,这里尽量使用strings.xml文件其中的字符串 android:gravity 指定Vi ...

  8. js中的referrer使用,返回上一页

    js完整代码: <script language="javascript"> var refer=document. referrer ;     document.g ...

  9. Android程序Crash时的异常上报

    转载请注明来源:http://blog.csdn.net/singwhatiwanna/article/details/17289479 前言 大家都知道,android应用不可避免的会发生crash ...

  10. gstreamer让playbin能够播放rtp over udp流数据

    最近一段时间在研究传屏低延迟传输相关的一些东西.本来想使用gstreamer来验证下rtp over udp传送h264 nal数据相关 的,结果发现竟然不能用playbin来播放rtp的数据!诚然, ...