RAC環境的恢復策略

yangtingkun發表於2007-06-26

對於RAC環境,不同的備份策略會導致備份檔案的分步不同,如果頻繁修改備份策略,或者備份策略混亂的話,會給恢復過程帶來很大的困難。


對於RAC環境中的多種備份策略,前面已經透過10篇文章詳細描述了,這裡想要強調的是,備份策略的不同,會導致備份結果的分步不同,進而影響恢復的策略和步驟。

一般情況下,恢復策略和備份策略必須是對應的。如果備份策略進行了修改,那麼恢復也應該採用相同的策略。

這樣描述太過於抽象,舉個例子,比如備份的時候用RMAN配置兩個CHANNEL,每個CHANNEL都透過CONNECT語句指向一個例項,在備份的時候,兩個CHANNEL同時執行,每個例項會將本CHANNEL讀取的資料檔案寫到這個例項所在伺服器所掛接的磁帶上。

而在恢復過程中,每個節點都只能掛接自己備份的磁帶,而無法恢復別的節點備份的磁帶。也就是說,恢復也必須啟動兩個CHANNEL,每個連線到一個例項上,同時進行恢復。

為了避免出現問題,建議在變更備份策略後,馬上對整個資料庫進行一次備份。另外在恢復之前,可以考慮利用VALIDATE來驗證恢復是否是可行的,下面這個例子就說明備份機制和恢復機制不同的話,會造成的問題:

bash-2.03$ export NLS_LANG=american
bash-2.03$ export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
bash-2.03$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Tue Jun 26 13:11:42 2007

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

connected to target database: TESTRAC (DBID=4291216984, not open)

RMAN> run
2> {
3> set until time '2007-6-21 0:0:0';
4> restore database;
5> recover database;
6> }

executing command: SET until clause
using target database control file instead of recovery catalog

Starting restore at 2007-06-26 13:14:31
configuration for SBT_TAPE channel 2 is ignored
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=313 instance=testrac2 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: VERITAS NetBackup for Oracle - Release 6.0 (2006110304)
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=305 instance=testrac2 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=304 instance=testrac2 devtype=DISK

channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
restoring datafile 00006 to +DISK/testrac/datafile/zhejiang01.dbf
restoring datafile 00008 to +DISK/testrac/datafile/ndmain01.dbf
restoring datafile 00009 to +DISK/testrac/datafile/zhejiang03.dbf
restoring datafile 00010 to +DISK/testrac/datafile/ndindex01.dbf
restoring datafile 00012 to +DISK/testrac/datafile/zhejiang05.dbf
channel ORA_SBT_TAPE_1: reading from backup piece krikm8an_1_1
ORA-19870: error reading backup piece krikm8an_1_1
ORA-19507: failed to retrieve sequential file, handle="krikm8an_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DISK/testrac/datafile/system.262.618591167
restoring datafile 00002 to +DISK/testrac/datafile/undotbs1.263.618591197
channel ORA_SBT_TAPE_1: reading from backup piece kvikmgua_1_1
ORA-19870: error reading backup piece kvikmgua_1_1
ORA-19507: failed to retrieve sequential file, handle="kvikmgua_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to +DISK/testrac/datafile/sysaux.264.618591225
restoring datafile 00004 to +DISK/testrac/datafile/undotbs2.266.618591249
restoring datafile 00007 to +DISK/testrac/datafile/zhejiang02.dbf
restoring datafile 00011 to +DISK/testrac/datafile/zhejiang04.dbf
restoring datafile 00013 to +DISK/testrac/datafile/lt_index_ts01.dbf
restoring datafile 00014 to +DISK/testrac/datafile/zhejiang06.dbf
restoring datafile 00015 to +DISK/testrac/datafile/gpo.367.624623443
channel ORA_SBT_TAPE_1: reading from backup piece liikp6gh_1_3
channel ORA_SBT_TAPE_1: restored backup piece 1
piece handle=liikp6gh_1_3 tag=TAG20070620T185927
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:31:05
failover to previous backup

channel ORA_DISK_1: restoring datafile 00001
input datafile copy recid=334 stamp=625680829 filename=/data1/backup/system.dbf
destination for restore of datafile 00001: +DISK/testrac/datafile/system.262.618591167
ORA-19505: failed to identify file "/data1/backup/system.dbf"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
ORA-19600: input file is datafile-copy 334 (/data1/backup/system.dbf)
ORA-19601: output file is datafile 1 (+DISK/testrac/datafile/system.262.618591167)
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00006 to +DISK/testrac/datafile/zhejiang01.dbf
restoring datafile 00008 to +DISK/testrac/datafile/ndmain01.dbf
restoring datafile 00009 to +DISK/testrac/datafile/zhejiang03.dbf
restoring datafile 00010 to +DISK/testrac/datafile/ndindex01.dbf
restoring datafile 00012 to +DISK/testrac/datafile/zhejiang05.dbf
channel ORA_SBT_TAPE_1: reading from backup piece kjiklia0_1_1
ORA-19870: error reading backup piece kjiklia0_1_1
ORA-19507: failed to retrieve sequential file, handle="kjiklia0_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
channel ORA_SBT_TAPE_1: reading from backup piece knikm6aq_1_1
ORA-19870: error reading backup piece knikm6aq_1_1
ORA-19507: failed to retrieve sequential file, handle="knikm6aq_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to +DISK/testrac/datafile/undotbs1.263.618591197
channel ORA_SBT_TAPE_1: reading from backup piece krikm8an_1_1
ORA-19870: error reading backup piece krikm8an_1_1
ORA-19507: failed to retrieve sequential file, handle="krikm8an_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
failover to previous backup

channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00009 to +DISK/testrac/datafile/zhejiang03.dbf
channel ORA_SBT_TAPE_1: reading from backup piece k0ikjnpt_1_1
channel ORA_SBT_TAPE_1: restored backup piece 1
piece handle=k0ikjnpt_1_1 tag=TAG20070618T171750
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:27:55
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00012 to +DISK/testrac/datafile/zhejiang05.dbf
channel ORA_SBT_TAPE_1: reading from backup piece jvikjnpv_1_1
ORA-19870: error reading backup piece jvikjnpv_1_1
ORA-19507: failed to retrieve sequential file, handle="jvikjnpv_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00006 to +DISK/testrac/datafile/zhejiang01.dbf
restoring datafile 00008 to +DISK/testrac/datafile/ndmain01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece juikjnpv_1_1
ORA-19870: error reading backup piece juikjnpv_1_1
ORA-19507: failed to retrieve sequential file, handle="juikjnpv_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00010 to +DISK/testrac/datafile/ndindex01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece kfiklhd6_1_1
ORA-19870: error reading backup piece kfiklhd6_1_1
ORA-19507: failed to retrieve sequential file, handle="kfiklhd6_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to +DISK/testrac/datafile/undotbs1.263.618591197
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
channel ORA_SBT_TAPE_1: reading from backup piece kjiklia0_1_1
ORA-19870: error reading backup piece kjiklia0_1_1
ORA-19507: failed to retrieve sequential file, handle="kjiklia0_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DISK/testrac/datafile/system.262.618591167
channel ORA_SBT_TAPE_1: reading from backup piece l4iko4cr_1_1
ORA-19870: error reading backup piece l4iko4cr_1_1
ORA-19507: failed to retrieve sequential file, handle="l4iko4cr_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
failover to previous backup

.

.

.

channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00010 to +DISK/testrac/datafile/ndindex01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece iiik9hb2_1_2
channel ORA_SBT_TAPE_1: restored backup piece 1
piece handle=iiik9hb2_1_2 tag=TAG20070614T202609
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:03:36
channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
channel ORA_SBT_TAPE_1: reading from backup piece j7ikirtu_1_1
ORA-19870: error reading backup piece j7ikirtu_1_1
ORA-19507: failed to retrieve sequential file, handle="j7ikirtu_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
failover to previous backup

channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
channel ORA_SBT_TAPE_1: reading from backup piece j3ikbop1_1_1
ORA-19870: error reading backup piece j3ikbop1_1_1
ORA-19507: failed to retrieve sequential file, handle="j3ikbop1_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
failover to previous backup

channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
channel ORA_SBT_TAPE_1: reading from backup piece ioikbn05_1_1
ORA-19870: error reading backup piece ioikbn05_1_1
ORA-19507: failed to retrieve sequential file, handle="ioikbn05_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
failover to previous backup

channel ORA_SBT_TAPE_1: starting datafile backupset restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
channel ORA_SBT_TAPE_1: reading from backup piece iiik9hb2_1_2
channel ORA_SBT_TAPE_1: restored backup piece 1
piece handle=iiik9hb2_1_2 tag=TAG20070614T202609
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:02:35
Finished restore at 2007-06-26 15:32:39

Starting recover at 2007-06-26 15:32:39
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
using channel ORA_DISK_2

starting media recovery

channel ORA_SBT_TAPE_1: starting archive log restore to default destination
channel ORA_SBT_TAPE_1: restoring archive log
archive log thread=2 sequence=253
channel ORA_SBT_TAPE_1: restoring archive log
archive log thread=1 sequence=338
channel ORA_SBT_TAPE_1: restoring archive log
archive log thread=2 sequence=254
channel ORA_SBT_TAPE_1: reading from backup piece jgikj1tq_1_1
channel ORA_SBT_TAPE_1: restored backup piece 1
piece handle=jgikj1tq_1_1 tag=TAG20070618T110427
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:03:25
archive log filename=/data1/archivelog/2_253_618591128.dbf thread=2 sequence=253
archive log filename=/data1/archivelog/1_338_618591128.dbf thread=1 sequence=338
channel ORA_SBT_TAPE_1: starting archive log restore to default destination
channel ORA_SBT_TAPE_1: restoring archive log
archive log thread=1 sequence=339
channel ORA_SBT_TAPE_1: restoring archive log
archive log thread=1 sequence=340
channel ORA_SBT_TAPE_1: reading from backup piece jfikj1tt_1_1
ORA-19870: error reading backup piece jfikj1tt_1_1
ORA-19507: failed to retrieve sequential file, handle="jfikj1tt_1_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
Backup file not found in NetBackup catalog
failover to previous backup
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+DISK/testrac/datafile/system.262.618591167'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/26/2007 15:37:07
RMAN-20506: no backup of archivelog found
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 340 lowscn 5215185427 found to restore
RMAN-06025: no backup of log thread 1 seq 339 lowscn 5214803171 found to restore

由於前面一段時間,在使用這個資料庫進行備份的測試,前後採用多種備份策略執行了很多次的備份操作。而這個恢復操作使用的又是不完全恢復,因此Oracle沒有選擇最新的備份進行恢復,造成了目前的恢復策略和備份是的不一致,Oracle在大量的失敗重試後,最終仍然是以錯誤結束了恢復操作。

想要解決這個問題,就必須採用合適的恢復策略:

RMAN> run
2> {
3> set until time '2007-6-21 0:0:0';
4> allocate channel c1 device type sbt connect 'sys/test@testrac1';
5> allocate channel c2 device type sbt connect 'sys/test@testrac2';
6> restore database;
7> recover database;
8> }

executing command: SET until clause

allocated channel: c1
channel c1: sid=313 instance=testrac1 devtype=SBT_TAPE
channel c1: VERITAS NetBackup for Oracle - Release 6.0 (2006110304)

allocated channel: c2
channel c2: sid=313 instance=testrac2 devtype=SBT_TAPE
channel c2: VERITAS NetBackup for Oracle - Release 6.0 (2006110304)

Starting restore at 2007-06-26 15:57:18

skipping datafile 3; already restored to file +DISK/testrac/datafile/sysaux.264.618591225
skipping datafile 4; already restored to file +DISK/testrac/datafile/undotbs2.266.618591249
skipping datafile 7; already restored to file +DISK/testrac/datafile/zhejiang02.dbf
skipping datafile 11; already restored to file +DISK/testrac/datafile/zhejiang04.dbf
skipping datafile 13; already restored to file +DISK/testrac/datafile/lt_index_ts01.dbf
skipping datafile 14; already restored to file +DISK/testrac/datafile/zhejiang06.dbf
skipping datafile 15; already restored to file +DISK/testrac/datafile/gpo.367.624623443
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to +DISK/testrac/datafile/users.267.618591279
restoring datafile 00006 to +DISK/testrac/datafile/zhejiang01.dbf
restoring datafile 00008 to +DISK/testrac/datafile/ndmain01.dbf
restoring datafile 00009 to +DISK/testrac/datafile/zhejiang03.dbf
restoring datafile 00010 to +DISK/testrac/datafile/ndindex01.dbf
restoring datafile 00012 to +DISK/testrac/datafile/zhejiang05.dbf
channel c1: reading from backup piece krikm8an_1_1
channel c1: restored backup piece 1
piece handle=krikm8an_1_1 tag=TAG20070619T161202
channel c1: restore complete, elapsed time: 01:29:13
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DISK/testrac/datafile/system.262.618591167
restoring datafile 00002 to +DISK/testrac/datafile/undotbs1.263.618591197
channel c1: reading from backup piece kvikmgua_1_1
channel c1: restored backup piece 1
piece handle=kvikmgua_1_1 tag=TAG20070619T183906
channel c1: restore complete, elapsed time: 00:05:26
Finished restore at 2007-06-26 17:32:10

Starting recover at 2007-06-26 17:32:11

starting media recovery

channel c2: starting archive log restore to default destination
channel c2: restoring archive log
archive log thread=1 sequence=345
channel c2: restoring archive log
archive log thread=1 sequence=346
channel c2: restoring archive log
archive log thread=1 sequence=347
channel c2: restoring archive log
archive log thread=1 sequence=348
channel c2: restoring archive log
archive log thread=1 sequence=349
channel c2: restoring archive log
archive log thread=2 sequence=263
channel c2: restoring archive log
archive log thread=2 sequence=264
channel c2: restoring archive log
archive log thread=1 sequence=350
channel c2: restoring archive log
archive log thread=2 sequence=265
channel c2: restoring archive log
archive log thread=1 sequence=351
channel c2: restoring archive log
archive log thread=2 sequence=266
channel c2: restoring archive log
archive log thread=1 sequence=352
channel c2: reading from backup piece r7il6c1t_1_1
channel c2: restored backup piece 1
piece handle=r7il6c1t_1_1 tag=TAG20070625T185347
channel c2: restore complete, elapsed time: 00:02:35
archive log filename=/data1/archivelog/1_345_618591128.dbf thread=1 sequence=345
channel c2: starting archive log restore to default destination
channel c2: restoring archive log
archive log thread=2 sequence=259
channel c2: restoring archive log
archive log thread=2 sequence=260
channel c2: restoring archive log
archive log thread=2 sequence=261
channel c2: restoring archive log
archive log thread=2 sequence=262
channel c2: reading from backup piece r8il6c7n_1_1
channel c2: restored backup piece 1
piece handle=r8il6c7n_1_1 tag=TAG20070625T185347
channel c2: restore complete, elapsed time: 00:01:07
archive log filename=/data1/archivelog/2_259_618591128.dbf thread=2 sequence=259
archive log filename=/data1/archivelog/2_260_618591128.dbf thread=2 sequence=260
archive log filename=/data1/archivelog/1_346_618591128.dbf thread=1 sequence=346
archive log filename=/data1/archivelog/1_347_618591128.dbf thread=1 sequence=347
archive log filename=/data1/archivelog/2_261_618591128.dbf thread=2 sequence=261
archive log filename=/data1/archivelog/2_262_618591128.dbf thread=2 sequence=262
archive log filename=/data1/archivelog/1_348_618591128.dbf thread=1 sequence=348
archive log filename=/data1/archivelog/1_349_618591128.dbf thread=1 sequence=349
archive log filename=/data1/archivelog/2_263_618591128.dbf thread=2 sequence=263
archive log filename=/data1/archivelog/2_264_618591128.dbf thread=2 sequence=264
archive log filename=/data1/archivelog/1_350_618591128.dbf thread=1 sequence=350
archive log filename=/data1/archivelog/2_265_618591128.dbf thread=2 sequence=265
archive log filename=/data1/archivelog/1_351_618591128.dbf thread=1 sequence=351
archive log filename=/data1/archivelog/2_266_618591128.dbf thread=2 sequence=266
archive log filename=/data1/archivelog/1_352_618591128.dbf thread=1 sequence=352
media recovery complete, elapsed time: 00:00:58
Finished recover at 2007-06-26 17:37:08
released channel: c2
released channel: c1

RMAN> alter database open resetlogs;

database opened

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

相關文章