我们在做数据库应急打开的过程中,2662是一个比较经典,也是处理最多的一个问题,简单的说,2662错误的发生,就是数据块里的SCN大于current SCN 时,就会报ORA-600[2662]错误,可以参考ORACLE MOS的文档:ORA-600 [2662] "Block SCN is ahead of Current SCN" [ID 28929.1]
本文着重说明,我们如何去模拟2662错误。我们通过BBED工具,修改数据块的SCN来使得触发2662错误。
BBED> set filename '/home/oradata/test/test01.dbf'
FILENAME /home/oradata/test/test01.dbf
BBED> set block 1
BLOCK# 1
确认数据文件头的SCN
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0×0006d92c
ub2 kscnwrp @488 0×0000
ub4 kcvcptim @492 0×31036455
ub2 kcvcpthr @496 0×0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0×00000007
ub4 kcrbabno @504 0×0000034f
ub2 kcrbabof @508 0×0010
ub1 kcvcpetb[0] @512 0×02
ub1 kcvcpetb[1] @513 0×00
ub1 kcvcpetb[2] @514 0×00
ub1 kcvcpetb[3] @515 0×00
ub1 kcvcpetb[4] @516 0×00
ub1 kcvcpetb[5] @517 0×00
ub1 kcvcpetb[6] @518 0×00
ub1 kcvcpetb[7] @519 0×00
datafile header scn
ub4 kscnbas @484 0×0006d92c
随便跳转一个块:
BBED> set block 40
BLOCK# 40
BBED> p bas_kcbh
ub4 bas_kcbh @8 0×0006d92e
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0×06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0×00
ub1 spare2_kcbh @3 0×00
ub4 rdba_kcbh @4 0×01400028
ub4 bas_kcbh @8 0×0006d92e
ub2 wrp_kcbh @12 0×0000
ub1 seq_kcbh @14 0×02
ub1 flg_kcbh @15 0×04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xe212
ub2 spare3_kcbh @18 0×0000
BBED> p tailchk
ub4 tailchk @8188 0xd92e0602
可以看到tailchk校验由ub4 bas_kcbh的低4位+ub1 type_kcbh+ub1 seq_kcbh
现在我们开始修改当前块的SCN
当前块的SCN为
BBED> p bas_kcbh
ub4 bas_kcbh @8 0×0006d92e
而数据文件头的scn为:
ub4 kscnbas @484 0×0006d92c
准备修改为0×0038d92c
我们准备修改它超过文件头的SCN(注意翻转)
0×0006d92e—0×0138d92c 反转 —2cd93801偏移量为8
则
tailchk 修改为
0xd92e0602—d92c0602 反转—02062cd9 偏移量为8188
BBED> set mode edit
MODE Edit
BBED> set offset 8
OFFSET 8
BBED> dump
File: /home/oradata/test/test01.dbf (0)
Block: 40 Offsets: 8 to 519 Dba:0×00000000
————————————————————————
2ed90600 00000204 12e20000 01000000 4cca0000 27150600 00000000 03003201
19004001 ffff0000 00000000 00000000 00000000 00800000 27150600 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00015300 ffffb800 ea033203
32030000 5300271f c91e711e 141eba1d 5b1d021d a41c541c fe1bae1b 581b071b
b01a5f1a 081ab619 5e191219 c0187118 1c18c517 68171117 b4166416 0e16bf15
6a151e15 d0147c14 2e14da13 8a133413 e8129a12 4512f611 a1114e11 f510a310
4b10f70f 9d0f4a0f f10e9e0e 450ef40d 9d0d4d0d f70ca70c 510cfb0b 9f0b4a0b
ef0a990a 3d0ae809 8d093509 d7087f08 2108c807 69071907 c3067406 1f06d005
7b052e05 db048e04 3f04ea03 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> modify /x 2cd93801
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /home/oradata/test/test01.dbf (0)
Block: 40 Offsets: 8 to 519 Dba:0×00000000
————————————————————————
2cd93801 00000204 12e20000 01000000 4cca0000 27150600 00000000 03003201
19004001 ffff0000 00000000 00000000 00000000 00800000 27150600 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00015300 ffffb800 ea033203
32030000 5300271f c91e711e 141eba1d 5b1d021d a41c541c fe1bae1b 581b071b
b01a5f1a 081ab619 5e191219 c0187118 1c18c517 68171117 b4166416 0e16bf15
6a151e15 d0147c14 2e14da13 8a133413 e8129a12 4512f611 a1114e11 f510a310
4b10f70f 9d0f4a0f f10e9e0e 450ef40d 9d0d4d0d f70ca70c 510cfb0b 9f0b4a0b
ef0a990a 3d0ae809 8d093509 d7087f08 2108c807 69071907 c3067406 1f06d005
7b052e05 db048e04 3f04ea03 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>
tailchk 修改为
0xd92e0602—d92c0602 翻转—020622cd9 偏移量为8188
BBED> set offset 8188
OFFSET 8188
BBED> dump
File: /home/oradata/test/test01.dbf (0)
Block: 40 Offsets: 8188 to 8191 Dba:0×00000000
————————————————————————
02062ed9
<32 bytes per line>
BBED> modify /x 02062cd9
File: /home/oradata/test/test01.dbf (0)
Block: 40 Offsets: 8188 to 8191 Dba:0×00000000
————————————————————————
02062cd9
<32 bytes per line>
BBED> dump
File: /home/oradata/test/test01.dbf (0)
Block: 40 Offsets: 8188 to 8191 Dba:0×00000000
————————————————————————
02062cd9
<32 bytes per line>
BBED> sum apply
Check value for File 0, Block 40:
current = 0xe32c, required = 0xe32c
该测试目前来看,我将5号数据文件的40号块SCN递增了2千万,但是没有效果,现在尝试将system数据文件递增
BBED> set filename '/home/oradata/test/system01.dbf';
FILENAME /home/oradata/test/system01.dbf
BBED> set block 1
BLOCK# 1
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0×00072909
ub2 kscnwrp @488 0×0000
ub4 kcvcptim @492 0×3103696a
ub2 kcvcpthr @496 0×0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0×00000008
ub4 kcrbabno @504 0×0000011f
ub2 kcrbabof @508 0×0010
ub1 kcvcpetb[0] @512 0×02
ub1 kcvcpetb[1] @513 0×00
ub1 kcvcpetb[2] @514 0×00
ub1 kcvcpetb[3] @515 0×00
ub1 kcvcpetb[4] @516 0×00
ub1 kcvcpetb[5] @517 0×00
ub1 kcvcpetb[6] @518 0×00
ub1 kcvcpetb[7] @519 0×00
跳转到40号块:
BBED> set block 40
BLOCK# 40
BBED> p bas_kcbh
ub4 bas_kcbh @8 0×00060395
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0×06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0×00
ub1 spare2_kcbh @3 0×00
ub4 rdba_kcbh @4 0×00400028
ub4 bas_kcbh @8 0×00060395
ub2 wrp_kcbh @12 0×0000
ub1 seq_kcbh @14 0×01
ub1 flg_kcbh @15 0×06 (KCBHFDLC, KCBHFCKV)
ub2 chkval_kcbh @16 0xde21
ub2 spare3_kcbh @18 0×0000
BBED> p tailchk
ub4 tailchk @8188 0×03950601
可以看到tailchk校验由ub4 bas_kcbh的低4位+ub1 type_kcbh+ub1 seq_kcbh
现在我们开始修改当前块的SCN
当前块的SCN为
BBED> p bas_kcbh
ub4 bas_kcbh @8 0×00060395
而数据文件头的scn为:
ub4 kscnbas @484 0×00072909
同样准备修改为0×0138d92c
我们准备修改它超过文件头的SCN(注意翻转)
0×0006d92e—0×0138d92c 翻转 —2cd93801偏移量为8
则
tailchk 修改为
0×03950601—d92c0601 翻转—01062cd9 偏移量为8188
BBED> set mode edit
MODE Edit
BBED> set offset 8
OFFSET 8
BBED> dump
File: /home/oradata/test/system01.dbf (0)
Block: 40 Offsets: 8 to 519 Dba:0×00000000
————————————————————————
95030600 00000106 21de0000 01000000 02000000 04ed0500 00000000 02000200
00000000 00003300 13000000 11004000 1f001d00 00800000 580a0000 08002c00
d2000000 e6018000 c9001600 03200000 95030600 00078900 ffff3c01 d001cb00
cb000000 05000500 04000900 00000900 0b001400 0a001e00 68008600 0300891f
721f5b1f 441f2d1f a31e191e 8f1d011d a51c491c ff1ba31b 471bfd1a a11a451a
fb199f19 43192819 0d19f218 d718bc18 a1188618 6b185018 35180318 ce179b17
65173217 0117ce16 9a166416 2e16f815 c0158915 56152315 ef14bb14 87145314
2014ed13 ba138713 4f131713 dc12aa12 75124412 1112d911 0802a111 6e113b11
0311cb10 92105910 2210eb0f b40f7d0f 470f120f dc0ea50e 6e0e360e ff0dcc0d
990d660d 330d000d cd0c9a0c 670c340c f90bc70b 920b610b 2e0bf60a d001870a
540a210a e909b009 77094009 0909d208 9b086508 3008fa07 c3078c07 54071d07
ea06b706 83064f06 1b06e705 b4058105 4e051b05 e004ad04 78044304 1004da03
a2036c03 38030103 ca029c02 6e024002 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00006c02 140102c1 1a02c11b
01800180 0a484942 4f554e44 56414c02 c1090180 0180ffff 0180ffff 02c11a01
8003c209 3502c102 01800180 01806c02 140102c1 1a02c11b 01800180 0a484942
<32 bytes per line>
BBED> modify /x 2cd93801
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /home/oradata/test/system01.dbf (0)
Block: 40 Offsets: 8 to 519 Dba:0×00000000
————————————————————————
2cd93801 00000106 21de0000 01000000 02000000 04ed0500 00000000 02000200
00000000 00003300 13000000 11004000 1f001d00 00800000 580a0000 08002c00
d2000000 e6018000 c9001600 03200000 95030600 00078900 ffff3c01 d001cb00
cb000000 05000500 04000900 00000900 0b001400 0a001e00 68008600 0300891f
721f5b1f 441f2d1f a31e191e 8f1d011d a51c491c ff1ba31b 471bfd1a a11a451a
fb199f19 43192819 0d19f218 d718bc18 a1188618 6b185018 35180318 ce179b17
65173217 0117ce16 9a166416 2e16f815 c0158915 56152315 ef14bb14 87145314
2014ed13 ba138713 4f131713 dc12aa12 75124412 1112d911 0802a111 6e113b11
0311cb10 92105910 2210eb0f b40f7d0f 470f120f dc0ea50e 6e0e360e ff0dcc0d
990d660d 330d000d cd0c9a0c 670c340c f90bc70b 920b610b 2e0bf60a d001870a
540a210a e909b009 77094009 0909d208 9b086508 3008fa07 c3078c07 54071d07
ea06b706 83064f06 1b06e705 b4058105 4e051b05 e004ad04 78044304 1004da03
a2036c03 38030103 ca029c02 6e024002 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00006c02 140102c1 1a02c11b
01800180 0a484942 4f554e44 56414c02 c1090180 0180ffff 0180ffff 02c11a01
8003c209 3502c102 01800180 01806c02 140102c1 1a02c11b 01800180 0a484942
<32 bytes per line>
BBED> modify /x bb1b0340
BBED-00209: invalid number (bb1b0340)
如果这个时候bbed报错的话,我们可以分2步走,先修改前2个字节,在修改后两个字节
BBED> modify /x bb1b
BBED> set offset +2
OFFSET 10
BBED> modify /x 0340
tailchk 修改为
0×03950601—d92c0601 翻转—01062cd9 偏移量为8188
BBED> set offset 8188
OFFSET 8188
BBED> dump
File: /home/oradata/test/system01.dbf (0)
Block: 40 Offsets: 8188 to 8191 Dba:0×00000000
————————————————————————
01069503
<32 bytes per line>
BBED> modify /x 01062cd9
File: /home/oradata/test/system01.dbf (0)
Block: 40 Offsets: 8188 to 8191 Dba:0×00000000
————————————————————————
01062cd9
<32 bytes per line>
BBED> dump
File: /home/oradata/test/system01.dbf (0)
Block: 40 Offsets: 8188 to 8191 Dba:0×00000000
————————————————————————
01062cd9
<32 bytes per line>
BBED> sum apply
Check value for File 0, Block 40:
current = 0xdf1f, required = 0xdf1f
2662 如约而至:
Thu Aug 01 10:50:36 CST 2013
Errors in file /oracle/app/admin/test/bdump/test_smon_14956.trc:
ORA-00600: internal error code, arguments: [2662], [0], [469288], [0], [20502828], [4194344], [], []
Thu Aug 01 10:50:36 CST 2013
Errors in file /oracle/app/admin/test/udump/test_ora_15243.trc:
ORA-00600: internal error code, arguments: [2662], [0], [469295], [0], [20502828], [4194344], [], []
Thu Aug 01 10:50:39 CST 2013
Errors in file /oracle/app/admin/test/udump/test_ora_15243.trc:
ORA-00600: internal error code, arguments: [2662], [0], [469295], [0], [20502828], [4194344], [], []
Error 600 happened during db open, shutting down database
USER: terminating instance due to error 600
Instance terminated by USER, pid = 15243
ORA-1092 signalled during: ALTER DATABASE OPEN…
Thu Aug 01 10:50:40 CST 2013
Errors in file /oracle/app/admin/test/udump/test_ora_15243.trc:
ORA-00600: internal error code, arguments: [opiodr: call 2], [], [], [], [], [], [], []
ORA-27300: OS system dependent operation:semctl failed with status: 22
ORA-27301: OS failure message: Invalid argument
ORA-27302: failure occurred at: sskgpwpost1
ORA-27303: additional information: semid = 1572871
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [469295], [0], [20502828], [4194344], [], []
到这里算是把2662模拟出来了
我们可以校验一下2662对应的对象
查看是哪个块出现scn大于datafile header scn
由于2662的参数如下:ORA-600 [2662] [A][B][C][D][E]
ARGUMENTS:
Arg [a] Current SCN WRAP
Arg [b] Current SCN BASE –(即是select checkpoint_change# from v$database)也可理解为当前SCN
Arg [c] dependent SCN WRAP
Arg [d] dependent SCN BASE 即当前出现错误的数据块的SCN b和d即为2662产生的scn差
Arg [e] Where present this is the DBA where the dependent SCN came from. –即对应异常问题出现的DBA
------------------------------------------------------------------------------------
原博客地址:http://blog.itpub.net/23732248/
原作者:应以峰 (frank-ying)
-------------------------------------------------------------------------------------
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23732248/viewspace-1457081/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23732248/viewspace-1457081/