一.对数据文件检查
注意:应该在关闭数据库模式下进行bbed的操作
[oracle@ora10 controlfile]$ dbv file=/u01/app/oracle/oradata/ORCL/datafile/test_01.dbf blocksize=8192 DBVERIFY: Release 10.2.0.1.0 - Production on Fri Jan 16 23:05:01 2015 Copyright (c) 1982, 2005, Oracle. All rights reserved. DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf
Block Checking: DBA = 20974772, Block Type = KTB-managed data block
data header at 0xb7ee3264
kdbchk: the amount of space used is not equal to block size
used=3681 fsc=7 avsp=4407 dtl=8088
Page 3252 failed with check code 6110 DBVERIFY - Verification complete Total Pages Examined : 12800
Total Pages Processed (Data) : 3204
Total Pages Failing (Data) : 1
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 68
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 9528
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 434362 (0.434362)
[oracle@ora10 controlfile]$
文件test_01.dbf的3252块 出现问题
二.查找资料
dbsnake的建议,将所有itl的fsc全部改为0,然后将kdbh.kdbhavsp和kdbh.kdbhtosp的值改成相等。它们的值都等于dbv校验中显示的dtl-used=8088-3681=4407。
三.利用bbed修复
BBED> set dba 5,3252
DBA 0x01400cb4 (20974772 5,3252) BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf
BLOCK = 3252 Block Checking: DBA = 20974772, Block Type = KTB-managed data block
data header at 0xb7e7b264
kdbchk: the amount of space used is not equal to block size
used=3681 fsc=7 avsp=4407 dtl=8088
Block 3252 failed with check code 6110 DBVERIFY - Verification complete Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 1
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 0
Total Blocks Influx : 0 BBED> print kdbh
struct kdbh, 14 bytes @100
ub1 kdbhflag @100 0x00 (NONE)
b1 kdbhntab @101 1
b2 kdbhnrow @102 333
sb2 kdbhfrre @104 -1
sb2 kdbhfsbo @106 684
sb2 kdbhfseo @108 5423
b2 kdbhavsp @110 4407
b2 kdbhtosp @112 4416 BBED>
3.1 查看itl中的fsc
BBED> p ktbbhitl
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0004
ub2 kxidslt @46 0x001e
ub4 kxidsqn @48 0x000000eb
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00803a71
ub2 kubaseq @56 0x005f
ub1 kubarec @58 0x30
ub2 ktbitflg @60 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @62
b2 _ktbitfsc @62 7
ub2 _ktbitwrp @62 0x0007
ub4 ktbitbas @64 0x0006a0ba
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0002
ub2 kxidslt @70 0x0022
ub4 kxidsqn @72 0x000000f8
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x008090ac
ub2 kubaseq @80 0x0085
ub1 kubarec @82 0x1f
ub2 ktbitflg @84 0x8000 (KTBFCOM)
union _ktbitun, 2 bytes @86
b2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0x000600bc BBED>
修改 b2 _ktbitfsc 的值使其为0.
BBED> dump /v dba 5,3252 offset 62 count 32
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Offsets: 62 to 93 Dba:0x01400cb4
-------------------------------------------------------
0700baa0 06000200 2200f800 0000ac90 l ..籂...."... 80008500 1f000080 0000bc00 06000000 l .............. <16 bytes per line> BBED> modify /x 00 dba 5,3252 offset 62
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Offsets: 62 to 93 Dba:0x01400cb4
------------------------------------------------------------------------
0000baa0 06000200 2200f800 0000ac90 80008500 1f000080 0000bc00 06000000 <32 bytes per line> BBED> BBED> print ktbbhitl
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0004
ub2 kxidslt @46 0x001e
ub4 kxidsqn @48 0x000000eb
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00803a71
ub2 kubaseq @56 0x005f
ub1 kubarec @58 0x30
ub2 ktbitflg @60 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @62
b2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0x0006a0ba
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0002
ub2 kxidslt @70 0x0022
ub4 kxidsqn @72 0x000000f8
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x008090ac
ub2 kubaseq @80 0x0085
ub1 kubarec @82 0x1f
ub2 ktbitflg @84 0x8000 (KTBFCOM)
union _ktbitun, 2 bytes @86
b2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0x000600bc BBED> sum
Check value for File 5, Block 3252:
current = 0x0e90, required = 0x0e97 BBED> sum apply
Check value for File 5, Block 3252:
current = 0x0e97, required = 0x0e97 BBED>
3.2 修改kdbh.kdbhavsp和kdbh.kdbhtosp的值=8088-3681=4407
BBED> print kdbh
struct kdbh, 14 bytes @100
ub1 kdbhflag @100 0x00 (NONE)
b1 kdbhntab @101 1
b2 kdbhnrow @102 333
sb2 kdbhfrre @104 -1
sb2 kdbhfsbo @106 684
sb2 kdbhfseo @108 5423
b2 kdbhavsp @110 4407
b2 kdbhtosp @112 4416 BBED> dump /v dba 5,3252 offset 112 count 32
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Offsets: 112 to 143 Dba:0x01400cb4
-------------------------------------------------------
40110000 4d01b01d b81dc01d c81dd01d l @...M. d81de01d e81df01d f81d001e 081e101e l ...... <16 bytes per line> BBED> --4416的16进制1140 转储后为 4011 BBED> dump /v dba 5,3252 offset 110 count 32
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Offsets: 110 to 141 Dba:0x01400cb4
-------------------------------------------------------
37114011 00004d01 b01db81d c01dc81d l [email protected]. d01dd81d e01de81d f01df81d 001e081e l .... <16 bytes per line> BBED> --4407的16进制1137 转储后为3711 --修改值
BBED> modify /x 3711 dba 5,3252 offset 112
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Offsets: 112 to 143 Dba:0x01400cb4
------------------------------------------------------------------------
37110000 4d01b01d b81dc01d c81dd01d d81de01d e81df01d f81d001e 081e101e <32 bytes per line> BBED> --应用 BBED> sum apply
Check value for File 5, Block 3252:
current = 0x0ee0, required = 0x0ee0 BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf
BLOCK = 3252 DBVERIFY - Verification complete Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
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
--利用dbv检查
[oracle@ora10 controlfile]$ dbv file=/u01/app/oracle/oradata/ORCL/datafile/test_01.dbf blocksize=8192 DBVERIFY: Release 10.2.0.1.0 - Production on Fri Jan 16 23:40:02 2015 Copyright (c) 1982, 2005, Oracle. All rights reserved. DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf DBVERIFY - Verification complete Total Pages Examined : 12800
Total Pages Processed (Data) : 3204
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 68
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 9528
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 434362 (0.434362)
[oracle@ora10 controlfile]$