RAC环境下通过connect到数据库的实例,做备份与恢复的方法

http://www.dbasky.net/archives/2009/03/racconnect.html

假设在二个节点上进行数据库的备份和恢复,而个节点的实例都正常的运行。大致的操作步骤如下:
  1.备份如下:rman备份文件将生成到两台主机的目录下:
run{
allocate CHANNEL ch00  type DISK  CONNECT'sys/oracle@rdb1';
allocate CHANNEL ch01  type DISK  CONNECT'sys/oracle@rdb2';
backup database    format '/rmanset/full_%d%t%s%p'         tag 'fullbackup';
sql 'alter system archive log current';
BACKUP FORMAT '/rmanset/%d_arch_%s_%p_%h' ARCHIVELOG ALL delete input;                                        
backup format '/rmanset/cf_%d' current controlfile;
RELEASE CHANNEL ch00;                                                        
RELEASE CHANNEL ch01;                                                      
}

rac1-> rman target / nocatalog
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Nov 26 00:30:03 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: RACDB (DBID=667104169)
using target database control file instead of recovery catalog
RMAN> run{
2>  allocate CHANNEL ch00  type DISK  CONNECT'sys/oracle@rdb1';
3>  allocate CHANNEL ch01  type DISK  CONNECT'sys/oracle@rdb2';
4>  backup database    format '/rmanset/full_%d%t%s%p'         tag 'fullbackup';
5>  sql 'alter system archive log current';
6>  BACKUP FORMAT '/rmanset/%d_arch_%s_%p_%h' ARCHIVELOG ALL delete input;                                        
7>  backup format '/rmanset/cf_%d' current controlfile;
8>  RELEASE CHANNEL ch00;                                                        
9>  RELEASE CHANNEL ch01;                                                      
10>  }
allocated channel: ch00
channel ch00: sid=153 instance=rdb1 devtype=DISK
allocated channel: ch01
channel ch01: sid=120 instance=rdb2 devtype=DISK
Starting backup at 26-NOV-08
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
input datafile fno=00003 name=+RACDATA/racdb/datafile/sysaux.261.669487497
input datafile fno=00002 name=+RACDATA/racdb/datafile/undotbs1.260.669487479
input datafile fno=00004 name=+RACDATA/racdb/datafile/undotbs2.263.669487539
channel ch00: starting piece 1 at 26-NOV-08
channel ch01: starting full datafile backupset
channel ch01: specifying datafile(s) in backupset
input datafile fno=00001 name=+RACDATA/racdb/datafile/system.259.669487425
input datafile fno=00006 name=+RACDATA/racdb/datafile/rman_backup.268.671103645
input datafile fno=00005 name=+RACDATA/racdb/datafile/users.264.669487561
channel ch01: starting piece 1 at 26-NOV-08
channel ch01: finished piece 1 at 26-NOV-08
piece handle=/rmanset/full_RACDB6717618001931 tag=FULLBACKUP comment=NONE
channel ch01: backup set complete, elapsed time: 00:02:10
channel ch01: starting full datafile backupset
channel ch01: specifying datafile(s) in backupset
including current control file in backupset
channel ch01: starting piece 1 at 26-NOV-08
channel ch00: finished piece 1 at 26-NOV-08
piece handle=/rmanset/full_RACDB6717618141921 tag=FULLBACKUP comment=NONE
channel ch00: backup set complete, elapsed time: 00:02:22
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ch00: starting piece 1 at 26-NOV-08
channel ch01: finished piece 1 at 26-NOV-08
piece handle=/rmanset/full_RACDB6717619311941 tag=FULLBACKUP comment=NONE
channel ch01: backup set complete, elapsed time: 00:00:13
channel ch00: finished piece 1 at 26-NOV-08
piece handle=/rmanset/full_RACDB6717619571951 tag=FULLBACKUP comment=NONE
channel ch00: backup set complete, elapsed time: 00:00:02
Finished backup at 26-NOV-08
sql statement: alter system archive log current
Starting backup at 26-NOV-08
current log archived
released channel: ch00
released channel: ch01
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 11/26/2008 00:32:56
RMAN-06726: could not locate archivelog /rdb1_arch/1_1_671755092.dbf
RMAN> crosscheck archivelog all;
RMAN> run{
2>  allocate CHANNEL ch00  type DISK  CONNECT'sys/oracle@rdb1';
3>  allocate CHANNEL ch01  type DISK  CONNECT'sys/oracle@rdb2';
4>  sql 'alter system archive log current';
5>  BACKUP FORMAT '/rmanset/%d_arch_%s_%p_%h' ARCHIVELOG ALL delete input;                                        
6>  backup format '/rmanset/cf_%d' current controlfile;
7>  RELEASE CHANNEL ch00;                                                        
8>  RELEASE CHANNEL ch01;                                                      
9>  }
released channel: ORA_DISK_1
allocated channel: ch00
channel ch00: sid=153 instance=rdb1 devtype=DISK
allocated channel: ch01
channel ch01: sid=120 instance=rdb2 devtype=DISK
sql statement: alter system archive log current
Starting backup at 26-NOV-08
current log archived
channel ch00: starting archive log backupset
channel ch00: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=370 stamp=671761661
input archive log thread=1 sequence=2 recid=372 stamp=671761676
input archive log thread=1 sequence=3 recid=373 stamp=671761677
input archive log thread=1 sequence=4 recid=374 stamp=671761683
input archive log thread=1 sequence=5 recid=376 stamp=671761688
input archive log thread=1 sequence=6 recid=379 stamp=671761962
channel ch00: starting piece 1 at 26-NOV-08
channel ch01: starting archive log backupset
channel ch01: specifying archive log(s) in backup set
input archive log thread=1 sequence=7 recid=380 stamp=671761968
input archive log thread=1 sequence=8 recid=383 stamp=671762080
input archive log thread=1 sequence=9 recid=385 stamp=671762085
input archive log thread=2 sequence=1 recid=368 stamp=671761639
input archive log thread=2 sequence=2 recid=369 stamp=671761644
input archive log thread=2 sequence=3 recid=371 stamp=671761649
input archive log thread=2 sequence=4 recid=375 stamp=671761671
input archive log thread=2 sequence=5 recid=377 stamp=671761676
input archive log thread=2 sequence=6 recid=378 stamp=671761946
channel ch01: starting piece 1 at 26-NOV-08
channel ch00: finished piece 1 at 26-NOV-08
piece handle=/rmanset/RACDB_arch_196_1_1 tag=TAG20081126T003446 comment=NONE
channel ch00: backup set complete, elapsed time: 00:00:00
channel ch00: deleting archive log(s)
archive log filename=/rdb1_arch/1_1_671761416.dbf recid=370 stamp=671761661
archive log filename=/rdb1_arch/1_2_671761416.dbf recid=372 stamp=671761676
archive log filename=/rdb1_arch/1_3_671761416.dbf recid=373 stamp=671761677
archive log filename=/rdb1_arch/1_4_671761416.dbf recid=374 stamp=671761683
archive log filename=/rdb1_arch/1_5_671761416.dbf recid=376 stamp=671761688
archive log filename=/rdb1_arch/1_6_671761416.dbf recid=379 stamp=671761962
channel ch01: finished piece 1 at 26-NOV-08
piece handle=/rmanset/RACDB_arch_197_1_2 tag=TAG20081126T003446 comment=NONE
channel ch01: backup set complete, elapsed time: 00:00:01
channel ch01: deleting archive log(s)
archive log filename=/rdb1_arch/1_7_671761416.dbf recid=380 stamp=671761968
archive log filename=/rdb1_arch/1_8_671761416.dbf recid=383 stamp=671762080
archive log filename=/rdb1_arch/1_9_671761416.dbf recid=385 stamp=671762085
archive log filename=/rdb2_arch/2_1_671761416.dbf recid=368 stamp=671761639
archive log filename=/rdb2_arch/2_2_671761416.dbf recid=369 stamp=671761644
archive log filename=/rdb2_arch/2_3_671761416.dbf recid=371 stamp=671761649
archive log filename=/rdb2_arch/2_4_671761416.dbf recid=375 stamp=671761671
archive log filename=/rdb2_arch/2_5_671761416.dbf recid=377 stamp=671761676
archive log filename=/rdb2_arch/2_6_671761416.dbf recid=378 stamp=671761946
channel ch00: starting archive log backupset
channel ch00: specifying archive log(s) in backup set
input archive log thread=2 sequence=7 recid=381 stamp=671761959
input archive log thread=2 sequence=8 recid=382 stamp=671762064
input archive log thread=2 sequence=9 recid=384 stamp=671762067
channel ch00: starting piece 1 at 26-NOV-08
channel ch00: finished piece 1 at 26-NOV-08
piece handle=/rmanset/RACDB_arch_198_1_2 tag=TAG20081126T003446 comment=NONE
channel ch00: backup set complete, elapsed time: 00:00:02
channel ch00: deleting archive log(s)
archive log filename=/rdb2_arch/2_7_671761416.dbf recid=381 stamp=671761959
archive log filename=/rdb2_arch/2_8_671761416.dbf recid=382 stamp=671762064
archive log filename=/rdb2_arch/2_9_671761416.dbf recid=384 stamp=671762067

2。数据库关闭后,做恢复:
rac1-> rman target / nocatalog
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Nov 26 00:39:23 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area     171966464 bytes
Fixed Size                     1218340 bytes
Variable Size                125831388 bytes
Database Buffers              41943040 bytes
Redo Buffers                   2973696 bytes
RMAN> restore controlfile from '/rmanset/cf_RACDB';
Starting restore at 26-NOV-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 instance=rdb1 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:11
output filename=+RACDATA/racdb/controlfile/current.256.669487407
Finished restore at 26-NOV-08
RMAN> sql          
2> 'alter database mount';
sql statement: alter database mount
released channel: ORA_DISK_1
3.实例2也要启动到mount,才开始做resotre database:

RMAN> run{
2>  allocate CHANNEL ch00  type DISK  CONNECT'sys/oracle@rdb1';
3>  allocate CHANNEL ch01  type DISK  CONNECT'sys/oracle@rdb2';
4> restore database;
5> }
allocated channel: ch00
channel ch00: sid=147 instance=rdb1 devtype=DISK
allocated channel: ch01
channel ch01: sid=151 instance=rdb2 devtype=DISK
Starting restore at 26-NOV-08
channel ch00: starting datafile backupset restore
channel ch00: specifying datafile(s) to restore from backup set
restoring datafile 00002 to +RACDATA/racdb/datafile/undotbs1.260.669487479
restoring datafile 00003 to +RACDATA/racdb/datafile/sysaux.261.669487497
restoring datafile 00004 to +RACDATA/racdb/datafile/undotbs2.263.669487539
channel ch00: reading from backup piece /rmanset/full_RACDB6717618141921
channel ch01: starting datafile backupset restore
channel ch01: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +RACDATA/racdb/datafile/system.259.669487425
restoring datafile 00005 to +RACDATA/racdb/datafile/users.264.669487561
restoring datafile 00006 to +RACDATA/racdb/datafile/rman_backup.268.671103645
channel ch01: reading from backup piece /rmanset/full_RACDB6717618001931
channel ch01: restored backup piece 1
piece handle=/rmanset/full_RACDB6717618001931 tag=FULLBACKUP
channel ch01: restore complete, elapsed time: 00:01:44
channel ch00: restored backup piece 1
piece handle=/rmanset/full_RACDB6717618141921 tag=FULLBACKUP
channel ch00: restore complete, elapsed time: 00:02:09
Finished restore at 26-NOV-08
released channel: ch00
released channel: ch01
4.restore archivelogfile
RMAN> run{
2>  allocate CHANNEL ch00  type DISK  CONNECT'sys/oracle@rdb1';
allocate CHANNEL ch01  type DISK  CONNECT'sys/oracle@rdb2';
3> 4> restore (archivelog sequence between 1 and 10 thread 1);
5>  restore (archivelog sequence between 1 and 7 thread 2);
6> }
released channel: ORA_DISK_1
allocated channel: ch00
channel ch00: sid=147 instance=rdb1 devtype=DISK
allocated channel: ch01
channel ch01: sid=151 instance=rdb2 devtype=DISK
Starting restore at 26-NOV-08
archive log thread 1 sequence 6 is already on disk as file /rdb1_arch/1_6_671761416.dbf
channel ch00: starting archive log restore to default destination
channel ch01: starting archive log restore to default destination
channel ch00: restoring archive log
archive log thread=1 sequence=1
channel ch00: restoring archive log
archive log thread=1 sequence=2
channel ch01: restoring archive log
archive log thread=1 sequence=7
channel ch00: restoring archive log
archive log thread=1 sequence=3
channel ch00: restoring archive log
archive log thread=1 sequence=4
channel ch01: restoring archive log
archive log thread=1 sequence=8
channel ch00: restoring archive log
archive log thread=1 sequence=5
channel ch00: reading from backup piece /rmanset/RACDB_arch_196_1_1
channel ch01: restoring archive log
archive log thread=1 sequence=9
channel ch01: reading from backup piece /rmanset/RACDB_arch_197_1_2
channel ch00: restored backup piece 1
piece handle=/rmanset/RACDB_arch_196_1_1 tag=TAG20081126T003446
channel ch00: restore complete, elapsed time: 00:00:02
channel ch01: restored backup piece 1
piece handle=/rmanset/RACDB_arch_197_1_2 tag=TAG20081126T003446
channel ch01: restore complete, elapsed time: 00:00:02
Finished restore at 26-NOV-08
Starting restore at 26-NOV-08
channel ch00: starting archive log restore to default destination
channel ch00: restoring archive log
archive log thread=2 sequence=7
channel ch00: reading from backup piece /rmanset/RACDB_arch_198_1_2
channel ch01: starting archive log restore to default destination
channel ch01: restoring archive log
archive log thread=2 sequence=1
channel ch00: restored backup piece 1
piece handle=/rmanset/RACDB_arch_198_1_2 tag=TAG20081126T003446
channel ch00: restore complete, elapsed time: 00:00:00
channel ch01: restoring archive log
archive log thread=2 sequence=2
channel ch01: restoring archive log
archive log thread=2 sequence=3
channel ch01: restoring archive log
archive log thread=2 sequence=4
channel ch01: restoring archive log
archive log thread=2 sequence=5
channel ch01: restoring archive log
archive log thread=2 sequence=6
channel ch01: reading from backup piece /rmanset/RACDB_arch_197_1_2
channel ch01: restored backup piece 1
piece handle=/rmanset/RACDB_arch_197_1_2 tag=TAG20081126T003446
channel ch01: restore complete, elapsed time: 00:00:02
Finished restore at 26-NOV-08
released channel: ch00
released channel: ch01
5。recover database:
RMAN> run{
2>  allocate CHANNEL ch00  type DISK  CONNECT'sys/oracle@rdb1';
3>  allocate CHANNEL ch01  type DISK  CONNECT'sys/oracle@rdb2';
4> recover database;
5> }
allocated channel: ch00
channel ch00: sid=147 instance=rdb1 devtype=DISK
allocated channel: ch01
channel ch01: sid=151 instance=rdb2 devtype=DISK
Starting recover at 26-NOV-08
starting media recovery
archive log thread 1 sequence 6 is already on disk as file /rdb1_arch/1_6_671761416.dbf
archive log thread 1 sequence 7 is already on disk as file /rdb2_arch/1_7_671761416.dbf
archive log thread 1 sequence 8 is already on disk as file /rdb2_arch/1_8_671761416.dbf
archive log thread 1 sequence 9 is already on disk as file +RACDATA/racdb/onlinelog/group_2.258.669487419
archive log thread 1 sequence 10 is already on disk as file +RACDATA/racdb/onlinelog/group_1.257.669487411
archive log thread 2 sequence 6 is already on disk as file /rdb2_arch/2_6_671761416.dbf
archive log thread 2 sequence 7 is already on disk as file /rdb1_arch/2_7_671761416.dbf
archive log thread 2 sequence 9 is already on disk as file +RACDATA/racdb/onlinelog/group_4.266.669489327
archive log thread 2 sequence 10 is already on disk as file +RACDATA/racdb/onlinelog/group_3.265.669489319
archive log filename=/rdb1_arch/1_6_671761416.dbf thread=1 sequence=6
archive log filename=/rdb2_arch/2_6_671761416.dbf thread=2 sequence=6
archive log filename=/rdb1_arch/2_7_671761416.dbf thread=2 sequence=7
archive log filename=/rdb2_arch/1_7_671761416.dbf thread=1 sequence=7
archive log filename=/rdb2_arch/1_8_671761416.dbf thread=1 sequence=8
channel ch00: starting archive log restore to default destination
channel ch00: restoring archive log
archive log thread=2 sequence=8
channel ch00: reading from backup piece /rmanset/RACDB_arch_198_1_2
channel ch00: restored backup piece 1
piece handle=/rmanset/RACDB_arch_198_1_2 tag=TAG20081126T003446
channel ch00: restore complete, elapsed time: 00:00:04
archive log filename=/rdb1_arch/2_8_671761416.dbf thread=2 sequence=8
archive log filename=+RACDATA/racdb/onlinelog/group_4.266.669489327 thread=2 sequence=9
archive log filename=+RACDATA/racdb/onlinelog/group_2.258.669487419 thread=1 sequence=9
archive log filename=+RACDATA/racdb/onlinelog/group_3.265.669489319 thread=2 sequence=10
archive log filename=+RACDATA/racdb/onlinelog/group_1.257.669487411 thread=1 sequence=10
media recovery complete, elapsed time: 00:00:03
Finished recover at 26-NOV-08
released channel: ch00
released channel: ch01
RMAN> alter database open resetlogs;
database opened
RMAN>
更多相关文章
  • 在本文中,介绍了rac环境下配置ogg的单向同步:在配置过程中,2节点的rac数据库做为source端,单实例的数据库作为target端,下面是具体的环境介绍!source端:操作系统版本:rhel5.4 64bit数据库版本:11.2.0.3 64bitogg版本:fbo_ggs_Linux_x6 ...
  • RAC环境下Dataguard到单机
    环境描述:Oracle Version:11.2.0.3.0Primary端:双节点的RAC,scan使用DNS解析,跑两个实例(JSTDB&PAYDB)Standby端:单机的Dataguard1.设置网络环境;vi /etc/hosts192.168.253.101    rac1.te ...
  •  上一讲介绍了rac环境下,当归档日志存储在本地文件系统时的备份与恢复操作,比较麻烦的是需要同步rac各个节点的归档日志,这无疑给备份和恢复操作增加了难度和需要的时间,因而本节中介绍使用多路归档的方式来尽量避免这个问题!一:配置多路归档 [oracle@rac1 ~]$ sqlplus sys/12 ...
  •   前面两节中介绍了rac环境下归档日志存储在ASM磁盘和集群文件系统环境下的备份和恢复操作,本节中将简要的介绍下当归档日志存储在本地文件系统环境下的备份和恢复,一般来讲,如果条件允许,应当尽可能将归档日志存储在共享存储上,或者设置多路归档日志,其中一路存储在共享存储上一:配置归档日志存储在本地文件 ...
  •   本节中将演示下rac环境下的数据的备份和完全恢复,rac的备份和恢复同单实例数据库对比,只是在处理归档日志上有些扩展,一般来讲,可以将归档日志存储在ASM磁盘组中,或者存储在集群文件系统上,NFS以及本地文件系统上,当归档日志存储在ASM,集群文件系统或者NFS上的时候,rac备份和恢复和单实例 ...
  • 在本文中将介绍在oracle 11g r2 rac环境下使用grid infrastructure来管理ogg服务,在开始之前,请先按照前文的步骤配置好rac(source)同单实例(target)数据库之间的ogg单向同步,同时确保rac数据库各项服务运行正常,同时启动target端的数据库实例和 ...
  • RAC环境下的备份与恢复五
    在前面的几个章节中,简要的介绍了在rac环境下对数据库执行备份和完全恢复,rac环境同单实例环境相比,除了需要备份控制文件,日志文件,数据文件和参数文件外,还需要对ocr和表决盘进行日常备份!下面来简要的介绍下votedisk和ocr的备份和恢复!一:表决盘的备份,Voting disk记录节点成员 ...
  • TAF是Transparent Application Failover的英文缩写,顾名思义就是对应用透明的故障转移,举个例子,当应用连接某个oracle数据库的执行查询操作的时候,数据库服务器网络中断或者实例崩溃,在经过delay参数设置的值之后,将自动连接到其他可用的实例,继续进行查询.(前提是 ...
一周排行
  • 简述Nginx及Nginx搭建
    简单罗列基础命令,只分享我的想法!一.Nginx简介Nginx("engine ...
  •    男人要求女人要长得漂亮,要有身材,要有气质,要有智慧...其实女人只是男人身上的一块肋骨.
  • 今天晚上打開電腦,發現主葉[url]www.hao123.com[/url],居然一片空白,再在地址欄輸入[url]www.hao123.com[/url],也打不開,但其他網址都沒問題,鬱悶,不知道好123被黑了, ...
  •  一.选择题 (1)多媒体版本的“清明上河图”分成54个场景进行高分辨率扫描,每个场景约为58.3MB,那么全图所需的存储容量是A)1.15GBB)2.15GBC)3.15GBD)4.15GB (2)关于计算机发展阶 ...
  • 今天跟某位老兄聊天,发现有些筒子是通过我的博客关注我们51CTO系统频道最新的内容动向的,所以决定在这里每个月开个帖,汇总一下我们频道的精品内容.专题推荐:近距离感受版本控制工具:GitIIS服务“讲武堂”Windo ...
  • 一.工具chrome插件:page speed insight 自动分析插件2.chrome工具:chrome > more tool >检测设备> inspect(需要代理)> networ ...
  • 杂志推荐FullCircle
    今天无意中发现了Full Circle这边杂志,觉得挺不错,推荐给大家.引用中文官方Wik ...
  • 数字签名主要经过以下几个过程: 信息发送者使用一单向散列函数(HASH函数)对信息生成信息摘要: 信息发送者使用自己的私钥签名信息摘要: 信息发送者把信息本身和已签名的信息摘要一起发送出去: 信息接收者通过使用与信息 ...
  • 最近在修改一个问题:就是修改home页下,用户手动拖出来的APP图片下面的字体显示不全,思路比较明确,需要尽量加大整个APP控件的高度,或者缩小图片和文字之间的间隔. 跟代码发现APP整个控件的layout由一个被成 ...
  • rsync安装,配置与错误解析
    一.流程图二.rsync的安装 1.卸载原来的rsync 当然在安装Linux操作系统时, ...