Rumah >pangkalan data >tutorial mysql >跳过丢失归档进行恢复
在我们恢复的时候,发现中间缺失归档,大部分dba认为从缺失的归档开始以后的归档都无法进行恢复。但是我们从非常规的方式,修改数据文件对应的信息是可以跳过该缺失的归档,并且利用后面的归档进行恢复的。 SYS@orcl11grecover datafile 6;ORA-00279: change
在我们恢复的时候,发现中间缺失归档,大部分dba认为从缺失的归档开始以后的归档都无法进行恢复。但是我们从非常规的方式,修改数据文件对应的信息是可以跳过该缺失的归档,并且利用后面的归档进行恢复的。
SYS@orcl11g>recover datafile 6; ORA-00279: change 2054392 generated at 10/28/2014 23:20:14 needed for thread 1 ORA-00289: suggestion : /opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_28/o1_mf_1_150_b50rqvq8_.arc ORA-00280: change 2054392 for thread 1 is in sequence #150 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} ORA-00326: log begins at change 2055246, need earlier change 2054392 ORA-00334: archived log: '/opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_28/o1_mf_1_150_b50rqvq8_.arc'这里我们发现对应的归档文件已经丢失,无法进行恢复
BBED> p kcvfhckp struct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x001f58f8 ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x3363df2e ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x00000095 ub4 kcrbabno @504 0x00000002 ub2 kcrbabof @508 0x0010 ub1 kcvcpetb[0] @512 0x02 ub1 kcvcpetb[1] @513 0x00 ub1 kcvcpetb[2] @514 0x00 ub1 kcvcpetb[3] @515 0x00 ub1 kcvcpetb[4] @516 0x00 ub1 kcvcpetb[5] @517 0x00 ub1 kcvcpetb[6] @518 0x00 ub1 kcvcpetb[7] @519 0x00 BBED> modify /x 96 offset 500 Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6) Block: 1 Offsets: 500 to 1011 Dba:0x01800001 ------------------------------------------------------------------------ 96000000 02000000 10000000 02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100 00000000 00000000 00000000 02008001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> sum apply Check value for File 6, Block 1: current = 0x6ce1, required = 0x6ce1 BBED> verify DBVERIFY - Verification starting FILE = /opt/oracle/oradata/orcl11g/zbdba01.dbf BLOCK = 1 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 Message 531 not found; product=RDBMS; facility=BBED BBED> show all FILE# 6 BLOCK# 1 OFFSET 500 DBA 0x01800001 (25165825 6,1) FILENAME /opt/oracle/oradata/orcl11g/zbdba01.dbf BIFILE bifile.bbd LISTFILE filelist.txt BLOCKSIZE 8192 MODE Edit EDIT Unrecoverable IBASE Dec OBASE Dec WIDTH 80 COUNT 512 LOGFILE log.bbd SPOOL No BBED> modify /x 1f5c4e offset 484 File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6) Block: 1 Offsets: 484 to 995 Dba:0x01800001 ------------------------------------------------------------------------ 1f5c4e00 00000000 2edf6333 01000000 96000000 02000000 10000000 02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100 00000000 00000000 00000000 02008001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> sum apply Check value for File 6, Block 1: current = 0x6857, required = 0x6857 BBED> verify DBVERIFY - Verification starting FILE = /opt/oracle/oradata/orcl11g/zbdba01.dbf BLOCK = 1 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 Message 531 not found; product=RDBMS; facility=BBED再次进行恢复:
SYS@orcl11g> SYS@orcl11g> SYS@orcl11g>recover datafile 6; Media recovery complete. SYS@orcl11g> SYS@orcl11g> SYS@orcl11g> SYS@orcl11g> SYS@orcl11g>alter database datafile 6 online; Database altered. 在生产环境不到万不得已,请勿效仿