您好,欢迎访问一九零五行业门户网

一次数据文件头不一致恢复

sys@orcl11galter database datafile 6 online;alter database datafile 6 online*error at line 1:ora-01113: file 6 needs media recoveryora-01110: data file 6: /opt/oracle/oradata/orcl11g/zbdba01.dbf 有时候我们数据文件offline之后,再online需要
sys@orcl11g>alter database datafile 6 online;alter database datafile 6 online*error at line 1:ora-01113: file 6 needs media recoveryora-01110: data file 6: '/opt/oracle/oradata/orcl11g/zbdba01.dbf'
有时候我们数据文件offline之后,再online需要介质恢复
sys@orcl11g>select file#,name,status from v$datafile; file# name status---------- ------------------------------------------------------------ ------------------------------------------------------------ 1 /opt/oracle/oradata/orcl11g/system01.dbf system 2 /opt/oracle/oradata/orcl11g/sysaux01.dbf online 3 /opt/oracle/oradata/orcl11g/undotbs01.dbf online 4 /opt/oracle/oradata/orcl11g/users01.dbf online 5 /opt/oracle/oradata/orcl11g/zbdba.dbf online 6 /opt/oracle/oradata/orcl11g/zbdba01.dbf recover 7 /opt/oracle/oradata/orcl11g/test.dbf online
但是我们归档已经丢失,无法完成介质恢复:sys@orcl11g>recover datafile 6;ora-00279: change 1986632 generated at 10/28/2014 05:16:11 needed for thread 1ora-00289: suggestion : /opt/oracle/flash_recovery_area/orcl11g/archivelog/2014_10_28/o1_mf_1_74_b4yqrglr_.arcora-00280: change 1986632 for thread 1 is in sequence #74specify log: {=suggested | filename | auto | cancel}ora-00308: cannot open archived log '/opt/oracle/flash_recovery_area/orcl11g/archivelog/2014_10_28/o1_mf_1_74_b4yqrglr_.arc'ora-27037: unable to obtain file statuslinux-x86_64 error: 2: no such file or directoryadditional information: 3
所以这时候我们直接修改文件头进行online:[oracle@ogg1 lib]$ bbed parfile=par.txtpassword:bbed: release 2.0.0.0.0 - limited production on tue oct 28 05:20:19 2014copyright (c) 1982, 2009, oracle and/or its affiliates. all rights reserved.************* !!! for oracle internal use only !!! ***************bbed>bbed>bbed> info allfile# name size(blks)----- ---- ---------- 1 /opt/oracle/oradata/orcl11g/system01.dbf 0 2 /opt/oracle/oradata/orcl11g/sysaux01.dbf 0 3 /opt/oracle/oradata/orcl11g/undotbs01.dbf 0 4 /opt/oracle/oradata/orcl11g/users01.dbf 0 5 /opt/oracle/oradata/orcl11g/zbdba.dbf 0 6 /opt/oracle/oradata/orcl11g/zbdba01.dbf 0 7 /opt/oracle/oradata/orcl11g/test.dbf 0bbed> set file 1 block 1 file# 1 block# 1bbed> p kcvfhckpstruct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x001e526c ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x3362e202 ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x0000004d ub4 kcrbabno @504 0x000001a6 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 0x00bbed> p kcvfhcpcub4 kcvfhcpc @140 0x000000f9bbed> p kcvfhcccub4 kcvfhccc @148 0x000000f8bbed> set file 6 block 1 file# 6 block# 1bbed> p kcvfhckpstruct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x001e5048 ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x3362e11b ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x0000004a ub4 kcrbabno @504 0x00005801 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 0x00bbed> p kcvfhcpcub4 kcvfhcpc @140 0x0000043cbbed> p kcvfhcccub4 kcvfhccc @148 0x0000043bbbed> modify /x 6c52 offset 484warning: contents of previous bifile will be lost. proceed? (y/n) yfile: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)block: 1 offsets: 484 to 995 dba:0x01800001------------------------------------------------------------------------6c521e00 00000000 1be16233 01000000 4a000000 01580000 10000000 0200000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 000000000d000d00 0d000100 00000000 00000000 00000000 02008001 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000bbed> modify /x 02e2 offset 492file: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)block: 1 offsets: 492 to 1003 dba:0x01800001------------------------------------------------------------------------02e26233 01000000 4a000000 01580000 10000000 02000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d00010000000000 00000000 00000000 02008001 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000bbed> modify /x f900 offset 140file: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)block: 1 offsets: 140 to 651 dba:0x01800001------------------------------------------------------------------------f9000000 7fe16233 3b040000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000006000000 05005a42 44424100 00000000 00000000 00000000 00000000 0000000000000000 06000000 00000000 00000000 a3d96233 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 6b946b29 01000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 6c521e00 0000000002e26233 01000000 4a000000 01580000 10000000 02000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100bbed> modify /x f800 offset 148file: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)block: 1 offsets: 148 to 659 dba:0x01800001------------------------------------------------------------------------f8000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 06000000 05005a4244424100 00000000 00000000 00000000 00000000 00000000 00000000 0600000000000000 00000000 a3d96233 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 6b946b29 01000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 6c521e00 00000000 02e26233 010000004a000000 01580000 10000000 02000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 0d000d00 0d000100 00000000 00000000bbed> sum applycheck value for file 6, block 1:current = 0x1924, required = 0x1924bbed> verifydbverify - verification startingfile = /opt/oracle/oradata/orcl11g/zbdba01.dbfblock = 1dbverify - verification completetotal blocks examined : 1total blocks processed (data) : 0total blocks failing (data) : 0total blocks processed (index): 0total blocks failing (index): 0total blocks empty : 0total blocks marked corrupt : 0total blocks influx : 0message 531 not found; product=rdbms; facility=bbedbbed> show all file# 6 block# 1 offset 148 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 nobbed> p kcvfhckpstruct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x001e526c ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x3362e202 ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x0000004a ub4 kcrbabno @504 0x00005801 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 0x00bbed> p kcvfhcpcub4 kcvfhcpc @140 0x000000f9bbed> p kcvfhcccub4 kcvfhccc @148 0x000000f8bbed>
修改完成后我们再次恢复该数据文件:sys@orcl11g>startuporacle instance started.total system global area 417546240 bytesfixed size 2213936 bytesvariable size 318769104 bytesdatabase buffers 92274688 bytesredo buffers 4288512 bytesdatabase mounted.database opened.sys@orcl11g>recover datafile 6;media recovery complete.sys@orcl11g>alter database datafile 6 online;database altered.
其它类似信息

推荐信息