学习bbed的过程中,修改了file# 4,block 396之后遇到kdbchk: the amount of space used is not equal to block size错误
注意:应该在关闭数据库模式下进行bbed的操作。
oracle@localhost.localdomain:/home/oracle/backup>dbv file=/opt/oracle/oradata/orcl/users01.dbf blocksize=8192
DBVERIFY: Release 10.2.0.1.0 - Production on Mon Aug 8 08:55:21 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /opt/oracle/oradata/orcl/users01.dbf
Block Checking: DBA = 16777612, Block Type = KTB-managed data block
data header at 0x2b297003027c
kdbchk: the amount of space used is not equal to block size
used=613 fsc=0 avsp=7494 dtl=8064
Page 396 failed with check code 6110
DBVERIFY - Verification complete
Total Pages Examined : 640
Total Pages Processed (Data) : 46
Total Pages Failing (Data) : 1
Total Pages Processed (Index): 63
Total Pages Failing (Index): 0
Total Pages Processed (Other): 142
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 389
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 747176 (0.747176)
咨询了dbsnake,按照他的建议,将所有itl的fsc全部改为0,然后将kdbh.kdbhavsp和kdbh.kdbhtosp的值改成相等,它们的值都等于dbv校验中显示的dtl-used。
BBED> set dba 4,396
DBA 0x0100018c (16777612 4,396)
BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/orcl/users01.dbf
BLOCK = 396
Block Checking: DBA = 16777612, Block Type = KTB-managed data block
data header at 0xd18387c
kdbchk: the amount of space used is not equal to block size
used=613 fsc=41 avsp=7451 dtl=8064
Block 396 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> set offset 0
OFFSET 0
BBED> p kdbh
struct kdbh, 14 bytes @124
ub1 kdbhflag @124 0x00 (NONE)
b1 kdbhntab @125 1
b2 kdbhnrow @126 14
sb2 kdbhfrre @128 -1
sb2 kdbhfsbo @130 46
sb2 kdbhfseo @132 7497
b2 kdbhavsp @134 7451
b2 kdbhtosp @136 7494
从上面的结果可以看出平均可利用空间kdbhavsp 和总的可利用空间kdbhtosp大小不一致。
查看itl中的fsc
BBED> set offset 44
OFFSET 44
BBED> p ktbbhitl
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0xffff
ub2 kxidslt @46 0x0000
ub4 kxidsqn @48 0x00000000
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00000000
ub2 kubaseq @56 0x0000
ub1 kubarec @58 0x00
ub2 ktbitflg @60 0x8000 (KTBFCOM)
union _ktbitun, 2 bytes @62
b2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0x000b0c24
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0001
ub2 kxidslt @70 0x002e
ub4 kxidsqn @72 0x0000015b
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x008000a6
ub2 kubaseq @80 0x00fa
ub1 kubarec @82 0x21
ub2 ktbitflg @84 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @86
b2 _ktbitfsc @86 41 --不为0
ub2 _ktbitwrp @86 0x0029
ub4 ktbitbas @88 0x000b2e92
struct ktbbhitl[2], 24 bytes @92
struct ktbitxid, 8 bytes @92
ub2 kxidusn @92 0x0000
ub2 kxidslt @94 0x0000
ub4 kxidsqn @96 0x00000000
struct ktbituba, 8 bytes @100
ub4 kubadba @100 0x00000000
ub2 kubaseq @104 0x0000
ub1 kubarec @106 0x00
ub2 ktbitflg @108 0x0000 (NONE)
union _ktbitun, 2 bytes @110
b2 _ktbitfsc @110 0
ub2 _ktbitwrp @110 0x0000
ub4 ktbitbas @112 0x00000000
修改 b2 _ktbitfsc 的值使其为0.
BBED> set offset 86
OFFSET 86
BBED> dump count 64
File: /opt/oracle/oradata/orcl/users01.dbf (4)
Block: 396 Offsets: 86 to 149 Dba:0x0100018c
------------------------------------------------------------------------
2900922e 0b000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000001 0e00ffff 2e00491d 1b1d461d 00000e00 5a1f2f1f 041fdb1e
BBED> modify /x 00
File: /opt/oracle/oradata/orcl/users01.dbf (4)
Block: 396 Offsets: 86 to 149 Dba:0x0100018c
------------------------------------------------------------------------
0000922e 0b000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000001 0e00ffff 2e00491d 1b1d461d 00000e00 5a1f2f1f 041fdb1e
查看修改后的itl信息
BBED> p ktbbhitl
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0xffff
ub2 kxidslt @46 0x0000
ub4 kxidsqn @48 0x00000000
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00000000
ub2 kubaseq @56 0x0000
ub1 kubarec @58 0x00
ub2 ktbitflg @60 0x8000 (KTBFCOM)
union _ktbitun, 2 bytes @62
b2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0x000b0c24
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0001
ub2 kxidslt @70 0x002e
ub4 kxidsqn @72 0x0000015b
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x008000a6
ub2 kubaseq @80 0x00fa
ub1 kubarec @82 0x21
ub2 ktbitflg @84 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @86
b2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0x000b2e92
struct ktbbhitl[2], 24 bytes @92
struct ktbitxid, 8 bytes @92
ub2 kxidusn @92 0x0000
ub2 kxidslt @94 0x0000
ub4 kxidsqn @96 0x00000000
struct ktbituba, 8 bytes @100
ub4 kubadba @100 0x00000000
ub2 kubaseq @104 0x0000
ub1 kubarec @106 0x00
ub2 ktbitflg @108 0x0000 (NONE)
union _ktbitun, 2 bytes @110
b2 _ktbitfsc @110 0
ub2 _ktbitwrp @110 0x0000
ub4 ktbitbas @112 0x00000000
BBED> p kdbh
struct kdbh, 14 bytes @124
ub1 kdbhflag @124 0x00 (NONE)
b1 kdbhntab @125 1
b2 kdbhnrow @126 14
sb2 kdbhfrre @128 -1
sb2 kdbhfsbo @130 46
sb2 kdbhfseo @132 7497
b2 kdbhavsp @134 7451
b2 kdbhtosp @136 7494
修改kdbhavsp的值于kdbhtosp保持一致
BBED> set offset 134
OFFSET 134
BBED> dump count 16
File: /opt/oracle/oradata/orcl/users01.dbf (4)
Block: 396 Offsets: 134 to 149 Dba:0x0100018c
------------------------------------------------------------------------
1b1d461d 00000e00 5a1f2f1f 041fdb1e
7494的十六进制对应的值为1D46,考虑到oracle数据块中的存储方式,做如下修改
BBED> modify /x 46
File: /opt/oracle/oradata/orcl/users01.dbf (4)
Block: 396 Offsets: 134 to 149 Dba:0x0100018c
------------------------------------------------------------------------
461d461d 00000e00 5a1f2f1f 041fdb1e
BBED> sum dba 4,396
Check value for File 4, Block 396:
current = 0x2b93, required = 0x2bce
BBED> sum dba 4,396 apply
Check value for File 4, Block 396:
current = 0x2bce, required = 0x2bce
检查测试:
BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/orcl/users01.dbf
BLOCK = 396
Block Checking: DBA = 16777612, Block Type = KTB-managed data block
data header at 0xd18387c
kdbchk: the amount of space used is not equal to block size
used=613 fsc=0 avsp=7494 dtl=8064
Block 396 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
在sqlplus 中dump数据块查看信息。
Block header dump: 0x0100018c
Object id on Block? Y
seg/obj: 0xcd2e csc: 0x00.b0c24 itc: 3 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1000189 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0xffff.000.00000000 0x00000000.0000.00 C--- 0 scn 0x0000.000b0c24
0x02 0x0001.02e.0000015b 0x008000a6.00fa.21 --U- 1 fsc 0x0000.000b2e92
0x03 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
dump 文件中的itl事务槽中的fsc信息和bbed中修改的信息不一致,即仍然有fsc 不为0。是不是这个原因呢?数据块上有回滚事务,关闭数据库以后:
再次检查,结果正确。
BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/orcl/users01.dbf
BLOCK = 396
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
DBVERIFY: Release 10.2.0.1.0 - Production on Mon Aug 8 13:19:28 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /opt/oracle/oradata/orcl/users01.dbf
DBVERIFY - Verification complete
Total Pages Examined : 640
Total Pages Processed (Data) : 51
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 63
Total Pages Failing (Index): 0
Total Pages Processed (Other): 145
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 381
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 794582 (0.794582)