ITPUX技术网

交流 . 资讯 . 分享
Make progress together!
Oracle数据库DBA高级工程师培训视频
Oracle数据库培训-备份恢复-性能优化-集群容灾
mysql数据库视频教程

Oracle RAC数据库在裸设备下的恢复

内容发布:paulyi| 发布时间:2014-1-25 13:51:00
Oracle RAC数据库在裸设备下的恢复

上一篇已经介绍了oracle rac在裸设备下的备份,这一篇介绍在oracle rac在裸设备下的恢复
首先备份并删除上次全备份以来的归档日志,然后准备开始恢复:
RMAN> run
2> {
3> allocate channel c1 device type disk format '/oradata/%U' connect sys/abcdefg@rac1;
4> allocate channel c2 device type disk format '/oradata/%U' connect sys/abcdefg@rac2;
5> backup archivelog all delete all input;
6> }

然后两个节点都启动到mount状态:
rac1
rman target /
startup mount;
rac2
rman target /
startup mount;
如果只启动其中一个节点,恢复数据文件会不成功
RMAN> run
2> {
3> allocate channel c1 device type disk format '/oradata/U%' connect sys/abcdefg@rac1;
4> allocate channel c2 device type disk format '/oradata/U%' connect sys/abcdefg@rac2;
5> restore database;
6> }
allocated channel: c1
channel c1: sid=145 instance=rac1 devtype=DISK
allocated channel: c2
channel c2: sid=144 instance=rac2 devtype=DISK
Starting restore at 04-JAN-09
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to +DISKGROUP/rac/datafile/undotbs1.269.669804571
restoring datafile 00003 to +DISKGROUP/rac/datafile/sysaux.270.669804585
restoring datafile 00005 to +DISKGROUP/rac/datafile/users.278.672888597
restoring datafile 00007 to /oradata/paul01.dbf
channel c1: reading from backup piece /oradata/19k3trip_1_1
channel c2: starting datafile backupset restore
channel c2: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DISKGROUP/rac/datafile/system.268.669804533
channel c2: reading from backup piece /oradata/1ak3trjc_1_1
channel c1: restored backup piece 1
piece handle=/oradata/19k3trip_1_1 tag=TAG20090103T230808
channel c1: restore complete, elapsed time: 00:00:52
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to +DISKGROUP/rac/datafile/undotbs2.272.669804611
channel c1: reading from backup piece /oradata/1bk3trjr_1_1
channel c2: restored backup piece 1
piece handle=/oradata/1ak3trjc_1_1 tag=TAG20090103T230808
channel c2: restore complete, elapsed time: 00:00:54
channel c1: restored backup piece 1
piece handle=/oradata/1bk3trjr_1_1 tag=TAG20090103T230808
channel c1: restore complete, elapsed time: 00:00:20
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00006 to +DISKGROUP/rac/datafile/test.277.669863437
channel c1: reading from backup piece /oradata/1ck3trk0_1_1
channel c1: restored backup piece 1
piece handle=/oradata/1ck3trk0_1_1 tag=TAG20090103T230808
channel c1: restore complete, elapsed time: 00:00:07
Finished restore at 04-JAN-09
released channel: c1
released channel: c2
现在连接到两个实例恢复归档日志文件
RMAN> run
2> {
3> allocate channel c1 device type disk format '/oradata/U%' connect sys/abcdefg@rac1;
allocate channel c2 device type disk format '/oradata/U%' connect sys/abcdefg@rac2;
restore (archivelog sequence between 9 and 11 thread 1)
(archivelog sequence between 9 and 11 thread 2);4> 5> 6>
7> }
allocated channel: c1
channel c1: sid=145 instance=rac1 devtype=DISK
allocated channel: c2
channel c2: sid=144 instance=rac2 devtype=DISK
Starting restore at 04-JAN-09
channel c1: starting archive log restore to default destination
channel c1: restoring archive log
archive log thread=1 sequence=9
channel c1: restoring archive log
archive log thread=1 sequence=10
channel c1: restoring archive log
archive log thread=1 sequence=11
channel c1: reading from backup piece /oradata/1gk3u31j_1_1
channel c2: starting archive log restore to default destination
channel c2: restoring archive log
archive log thread=2 sequence=9
channel c2: restoring archive log
archive log thread=2 sequence=10
channel c2: reading from backup piece /oradata/1hk3u311_1_1
channel c1: restored backup piece 1
piece handle=/oradata/1gk3u31j_1_1 tag=TAG20090104T011530
channel c1: restore complete, elapsed time: 00:00:04
channel c2: restored backup piece 1
piece handle=/oradata/1hk3u311_1_1 tag=TAG20090104T011530
channel c2: restore complete, elapsed time: 00:00:05
channel c2: starting archive log restore to default destination
channel c2: restoring archive log
archive log thread=2 sequence=11
channel c2: reading from backup piece /oradata/1ik3u318_1_1
channel c2: restored backup piece 1
piece handle=/oradata/1ik3u318_1_1 tag=TAG20090104T011530
channel c2: restore complete, elapsed time: 00:00:00
Finished restore at 04-JAN-09
released channel: c1
released channel: c2

介质恢复
RMAN> run
{
allocate channel c1 device type disk format '/oradata/U%' connect sys/abcdefg@rac1;
allocate channel c2 device type disk format '/oradata/U%' connect sys/abcdefg@rac2; 2> 3> 4>
5> recover database;
6> }
allocated channel: c1
channel c1: sid=145 instance=rac1 devtype=DISK
allocated channel: c2
channel c2: sid=144 instance=rac2 devtype=DISK
Starting recover at 04-JAN-09
starting media recovery
archive log thread 1 sequence 9 is already on disk as file /arch/1_9_675209275.dbf
archive log thread 1 sequence 10 is already on disk as file /arch/1_10_675209275.dbf
archive log thread 1 sequence 11 is already on disk as file /arch/1_11_675209275.dbf
channel c1: starting archive log restore to default destination
channel c1: restoring archive log
archive log thread=1 sequence=8
channel c1: reading from backup piece /oradata/1dk3trkt_1_1
channel c1: restored backup piece 1
piece handle=/oradata/1dk3trkt_1_1 tag=TAG20090103T230917
channel c1: restore complete, elapsed time: 00:00:01
archive log filename=/arch/1_8_675209275.dbf thread=1 sequence=8
channel c2: starting archive log restore to default destination
channel c1: starting archive log restore to default destination
channel c2: restoring archive log
archive log thread=2 sequence=9
channel c1: restoring archive log
archive log thread=2 sequence=8
channel c1: reading from backup piece /oradata/1ek3trkv_1_1
channel c2: restoring archive log
archive log thread=2 sequence=10
channel c2: reading from backup piece /oradata/1hk3u311_1_1
channel c1: restored backup piece 1
piece handle=/oradata/1ek3trkv_1_1 tag=TAG20090103T230917
channel c1: restore complete, elapsed time: 00:00:02
archive log filename=/arch/2_8_675209275.dbf thread=2 sequence=8
archive log filename=/arch/1_9_675209275.dbf thread=1 sequence=9
channel c2: restored backup piece 1
piece handle=/oradata/1hk3u311_1_1 tag=TAG20090104T011530
channel c2: restore complete, elapsed time: 00:00:03
failover to previous backup
archive log filename=/arch/2_9_675209275.dbf thread=2 sequence=9
released channel: c1
released channel: c2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/04/2009 01:38:24
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/arch/2_9_675209275.dbf'
ORA-00308: cannot open archived log '/arch/2_9_675209275.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

但是对于恢复(RECOVER)操作,只能一个实例完成。
这是因为一个实例必须能同时看到两个实例的归档日志,这里采用最简单的方法,将节点2上的归档拷贝到节点1的归档目录下。 拷过去恢复就可以了
RMAN> run
{
allocate channel c1 device type disk format '/oradata/U%' connect sys/abcdefg@rac1;
allocate channel c2 device type disk format '/oradata/U%' connect sys/abcdefg@rac2; 2> 3> 4>
5> recover database;
6> }
allocated channel: c1
channel c1: sid=145 instance=rac1 devtype=DISK
allocated channel: c2
channel c2: sid=144 instance=rac2 devtype=DISK
Starting recover at 04-JAN-09
starting media recovery
archive log thread 1 sequence 9 is already on disk as file /arch/1_9_675209275.dbf
archive log thread 1 sequence 10 is already on disk as file /arch/1_10_675209275.dbf
archive log thread 1 sequence 11 is already on disk as file /arch/1_11_675209275.dbf
archive log thread 2 sequence 9 is already on disk as file /arch/2_9_675209275.dbf
archive log thread 2 sequence 10 is already on disk as file /arch/2_10_675209275.dbf
archive log thread 2 sequence 11 is already on disk as file /arch/2_11_675209275.dbf
archive log filename=/arch/2_9_675209275.dbf thread=2 sequence=9
archive log filename=/arch/1_9_675209275.dbf thread=1 sequence=9
archive log filename=/arch/2_10_675209275.dbf thread=2 sequence=10
archive log filename=/arch/1_10_675209275.dbf thread=1 sequence=10
media recovery complete, elapsed time: 00:00:15
Finished recover at 04-JAN-09
released channel: c1
released channel: c2
RMAN> alter database open;
database opened
RMAN> exit

Recovery Manager complete.
sql[oracle@rac1 arch]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jan 4 01:49:53 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select count(*) from t;
COUNT(*)
----------
3856515
SQL>
恢复完成



上一篇:Oracle RAC数据库在裸设备下的备份过程
下一篇:Oracle RAC数据库在asm下的备份与恢复
回复

使用道具 举报

1框架
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表