oracle rac在裸裝置下的恢復

paulyibinyi發表於2009-01-04

   上一篇已經介紹了oracle rac在裸裝置下的備份,這一篇介紹在oracle rac在裸裝置下的恢復

    首先備份並刪除上次全備份以來的歸檔日誌,然後準備開始恢復:

RMAN> run
2> {
3> allocate channel c1 device type disk format '/oradata/%U' connect ;
4> allocate channel c2 device type disk format '/oradata/%U' connect  ;
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 ;
4> allocate channel c2 device type disk format '/oradata/U%' connect ;
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 ;
allocate channel c2 device type disk format '/oradata/U%' connect ;
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 ;
allocate channel c2 device type disk format '/oradata/U%' connect ; 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 ;
allocate channel c2 device type disk format '/oradata/U%' connect ; 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>

恢復完成

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-526491/,如需轉載,請註明出處,否則將追究法律責任。

相關文章