2015/09/02
desert_xu
上次使用bbed 提交事物失败,导致undo header 块损坏,导致重启,出现 ORA-00600: 内部错误代码, 参数: [kddummy_blkchk], [2], [41], [38504], [], [], [], [] 的错误。
俗话说 失败是成功之母,总结上次失败了的原因,主要是修改的地方遗漏了很多了,我只把简单的事物状态 state、cflags 改成 0900
0x1c 10 0x80 0x0027 0x0002 0x0000.000e06bc 0x018004bf 0x0000.000.00000000
看了好多大牛的写的blog,但是自己还是看不明白,但是大概的思路对了,通过find /x 查处相关的数据,不知道要找哪些数据修改哦,还是比较迷茫,只能dump了 大量的undo header trace 看看了,了解 undo header 结构,不过bbed对非SYSTEM undo header 是不能 print 相关的数据结构信息了,只能用dump命令查看然后结合猜着了。
-
BBED> map
-
File: /export/home/oracle/oradata/ora10g/system01.dbf (1)
-
Block: 9 Dba:0x00400009
-
------------------------------------------------------------
-
Unlimited Undo Segment Header
-
-
struct kcbh, 20 bytes @0 通用文件头
-
struct ktech, 72 bytes @20 undo extent control header
-
struct ktemh, 16 bytes @92 undo extent map header
-
struct ktetb[6], 48 bytes @108 extent table
-
struct ktuxc, 104 bytes @4148 extent control
-
struct ktuxe[255], 10200 bytes @4252 undo extent table
-
ub4 tailchk @8188
-
-
BBED> map/v
-
File: /export/home/oracle/oradata/ora10g/system01.dbf (1)
-
Block: 9 Dba:0x00400009
-
------------------------------------------------------------
-
Unlimited Undo Segment Header
-
-
struct kcbh, 20 bytes @0
-
ub1 type_kcbh @0
-
ub1 frmt_kcbh @1
-
ub1 spare1_kcbh @2
-
ub1 spare2_kcbh @3
-
ub4 rdba_kcbh @4
-
ub4 bas_kcbh @8
-
ub2 wrp_kcbh @12
-
ub1 seq_kcbh @14
-
ub1 flg_kcbh @15
-
ub2 chkval_kcbh @16
-
ub2 spare3_kcbh @18
-
-
struct ktech, 72 bytes @20 extent control header
-
ub4 spare1_ktech @20
-
word tsn_ktech @24
-
ub4 lastmap_ktech @28
-
ub4 mapcount_ktech @32
-
ub4 extents_ktech @36
-
ub4 blocks_ktech @40
-
ub2 mapend_ktech @44
-
struct hwmark_ktech, 32 bytes @48
-
struct locker_ktech, 8 bytes @80
-
ub4 flag_ktech @88
-
-
struct ktemh, 16 bytes @92 extent map header
-
ub4 count_ktemh @92
-
ub4 next_ktemh @96
-
ub4 obj_ktemh @100
-
ub4 flag_ktemh @104
-
-
struct ktetb[6], 48 bytes @108 extent table
-
ub4 ktetbdba @108
-
ub4 ktetbnbk @112
-
-
struct ktuxc, 104 bytes @4148 事物控制头
-
struct ktuxcscn, 8 bytes @4148
-
struct ktuxcuba, 8 bytes @4156
-
sb2 ktuxcflg @4164
-
ub2 ktuxcseq @4166
-
sb2 ktuxcnfb @4168
-
ub4 ktuxcinc @4172
-
sb2 ktuxcchd @4176
-
sb2 ktuxcctl @4178
-
ub2 ktuxcmgc @4180
-
ub4 ktuxcopt @4188
-
struct ktuxcfbp[5], 60 bytes @4192
-
-
struct ktuxe[255], 10200 bytes @4252 事物表
-
ub4 ktuxexid @4252
-
ub4 ktuxebrb @4256
-
struct ktuxescn, 8 bytes @4260
-
sb4 ktuxesta @4268
-
ub1 ktuxecfl @4269
-
sb2 ktuxeuel @4270
-
-
ub4 tailchk @8188
-
上面是system undo header 结构,从非system undo header dump trace 文件和 system undo header trace 文件 结构都一样,当然 offset 位置信息是不一样的哦。上面只能参考参考了。
后来我的想到了通过dump trace 文件来比对 oracle 在commit 之后做了哪些动作,改了哪些东西。
一下是实验
先俩个事物
SQL> insert into t1 values( 1,'AAAAA');
先不提交 然后 dump undo header
sys@ORA10G@159> SELECT xidusn,xidslot,xidsqn,ubablk,ubafil,ubasqn,ubarec FROM v$transaction;
XIDUSN XIDSLOT XIDSQN UBABLK UBAFIL UBASQN UBAREC
---------- ---------- ---------- ---------- ---------- ---------- ----------
17 28 39 1215 6 25 37
------------------------------------------------------------------------------------------------------------------------------------------------
selec name from v$rollname where usn=17;
-----------------------------------------------------------------------------
sys@ORA10G@159> alter system dump undo header '_SYSSMU17$';
系统已更改。
sys@ORA10G@159> oradebug setmypid
已处理的语句
sys@ORA10G@159> oradebug tracefile_name
/export/home/oracle/admin/ora10g/udump/ora10g_ora_14766.trc
sys@ORA10G@159> /export/home/oracle/admin/ora10g/udump/ora10g_ora_14766.trc
然后提交在dump undo 文件
-
---
-
> Unix process pid: 14780, image: oracle@solaris10 (TNS V1-V3)
-
15,17c15,16
-
< *** 2015-09-01 18:21:53.172
-
< *** SERVICE NAME:(SYS$USERS) 2015-09-01 18:21:53.172
-
< *** SESSION ID:(159.9) 2015-09-01 18:21:53.172
-
---
-
> *** SERVICE NAME:(SYS$USERS) 2015-09-01 18:24:50.837
-
> *** SESSION ID:(159.11) 2015-09-01 18:24:50.837
-
44c43
-
< TRN CTL:: seq: 0x0019 chd: 0x001f ctl: 0x0019 inc: 0x00000000 nfb: 0x0001
-
---
-
> TRN CTL:: seq: 0x0019 chd: 0x001f ctl: 0x001c inc: 0x00000000 nfb: 0x0002
-
49c48
-
< uba: 0x00000000.0019.24 ext: 0x2 spc: 0xbfa
-
---
-
> uba: 0x018004bf.0019.25 ext: 0x2 spc: 0xb74
-
83c82
-
< 0x19 9 0x00 0x0027 0xffff 0x0000.000e06ad 0x018004bf 0x0000.000.00000000
-
0x00000001 0x00000000 1441102692
-
---
-
> 0x19 9 0x00 0x0027 0x001c 0x0000.000e06ad 0x018004bf 0x0000.000.00000000
-
0x00000001 0x00000000 1441102692
-
86c85
-
< 0x1c 10 0x80 0x0027 0x0002 0x0000.000e06bc 0x018004bf 0x0000.000.00000000
-
0x00000001 0x00000000 0
-
---
-
> 0x1c 9 0x00 0x0027 0xffff 0x0000.000e0744 0x018004bf 0x0000.000.00000000
-
0x00000001 0x00000000 1441103043
这里要修改的数据 大概有四个地方
1、事物控制头部TRN CTL ctl:0019 ==>001c
2、最近一次commit的事物 uel 0xffff ==> 当前事物的slot#,trn tb 里的 index索引号(xidslot#) 0xffff=>001c
3、当前事物的state\cflags 0a80 ==> 0900
4、当前事物的uel 改成 ==> 无穷大 也就是 0xffff
未commit 的trace文件 部分
TRN CTL:: seq: 0x0019 chd: 0x001f ctl: 0x0019 inc: 0x00000000 nfb: 0x0001 --上次使用这个回滚段的事物的槽号(slot)
mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x018004bf.0019.25 scn: 0x0000.000e00f2
index state cflag wrap# uel scn uba
0x19 9 0x00 0x0027 0xffff 0x0000.000e06ad 0x018004bf 0x0000.000.00000000 0x00000001 0x00000000 1441102692 ----在本回滚段上次上次事物相关信息
0x1a 9 0x00 0x0027 0x0015 0x0000.000e0658 0x018004bf 0x0000.000.00000000 0x00000001 0x00000000 1441102663
0x1b 9 0x00 0x0026 0x0023 0x0000.000e018b 0x018004bd 0x0000.000.00000000 0x00000001 0x00000000 1441100372
0x1c 10 0x80 0x0027 0x0002 0x0000.000e06bc 0x018004bf 0x0000.000.00000000 0x00000001 0x00000000 0
0x1d 9 0x00 0x0026 0x002f 0x0000.000e032c 0x018004b8 0x0000.000.00000000 0x00000001 0x00000000 1441101312
0x1e 9 0x00 0x0026 0x0021 0x0000.000e012e 0x018004bd 0x0000.000.00000000 0x00000001 0x00000000 1441100169
0x1f 9 0x00 0x0026 0x001e 0x0000.000e0125 0x018004bd 0x0000.000.00000000 0x00000002 0x00000000 1441100169
然后再做实验 再插入一条数据
insert into t1 valus (1,'aaaaa');
不提交,dump trace 文件
sys@ORA10G@159> alter system flush buffer_cache;
系统已更改。
sys@ORA10G@159> alter system checkpoint;
系统已更改。
sys@ORA10G@159> SELECT xidusn,xidslot,xidsqn,ubablk,ubafil,ubasqn,ubarec FROM v$transaction;
XIDUSN XIDSLOT XIDSQN UBABLK UBAFIL UBASQN UBAREC
---------- ---------- ---------- ---------- ---------- ---------- ----------
14 29 44 1523 6 25 39
sys@ORA10G@159> ^[[A^[[A
" - 其余行忽略。
sys@ORA10G@159> ^[[A^[[A
sys@ORA10G@159> 令 "
sys@ORA10G@159> select name from v$rollname where usn=14;
NAME
------------------------------
_SYSSMU14$
sys@ORA10G@159> _SYSSMU14$
SP2-0042: 未知命令 "_SYSSMU14$" - 其余行忽略。
sys@ORA10G@159> alter system dump undo header '_SYSSMU14$';
系统已更改。
sys@ORA10G@159> oradebug setmypid
已处理的语句
sys@ORA10G@159> oradebug tracefile_name
/export/home/oracle/admin/ora10g/udump/ora10g_ora_14780.trc
sys@ORA10G@159> /export/home/oracle/admin/ora10g/udump/ora10g_ora_14780.trc
SP2-0734: 未知的命令开头 "/export/ho..." - 忽略了剩余的行。
sys@ORA10G@159>
sys@ORA10G@159> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
-bash-3.00$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.2.0 - Production on 星期二 9月 1 21:50:26 2015
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
sys@ORA10G@159> alter system dump undo header '_SYSSMU14$';
系统已更改。
sys@ORA10G@159> oradebug setmypid
已处理的语句
sys@ORA10G@159> oradebug tracefile_name
/export/home/oracle/admin/ora10g/udump/ora10g_ora_15202.trc
sys@ORA10G@159> /export/home/oracle/admin/ora10g/udump/ora10g_ora_15202.trc
SP2-0734: 未知的命令开头 "/export/ho..." - 忽略了剩余的行。
sys@ORA10G@159>
sys@ORA10G@159> _SYSSMU14
SP2-0042: 未知命令 "_SYSSMU14" - 其余行忽略。
sys@ORA10G@159> select header_file,header_block from dba_segments where segment_name='_SYSSMU14$';
HEADER_FILE HEADER_BLOCK
----------- ------------
6 57
sys@ORA10G@159> SELECT xidusn,xidslot,xidsqn,ubablk,ubafil,ubasqn,ubarec FROM v$transaction;
XIDUSN XIDSLOT XIDSQN UBABLK UBAFIL UBASQN UBAREC
---------- ---------- ---------- ---------- ---------- ---------- ----------
14 29 44 1523 6 25 39
一下是操作过程,需要细心、看仔细,不然出错就问题大了
-
BBED> find /x ffff top
-
File: /export/home/oracle/oradata/udotbs02.dbf (6)
-
Block: 121 Offsets: 6137 to 6236 Dba:0x01800079
-
------------------------------------------------------------------------
-
ffff7f00 0000001f 00040001 00ca1d82 0080011f 00140001 004e1500 00000015
-
0004000b 007e1d00 00000000 00000000 00000000 00000000 00000000 00000020
-
00000081 00800182 d40d0000 00a18709 00060000 00000000 00000000 00000001
-
00000010
-
-
<32 bytes per line>
-
-
BBED> f
-
File: /export/home/oracle/oradata/udotbs02.dbf (6)
-
Block: 121 Offsets: 7058 to 7157 Dba:0x01800079
-
------------------------------------------------------------------------
-
ffff0000 00000000 00000000 00000100 0000551f e5551f00 00008000 8001a0d0
-
0d000000 a1870900 18000000 00000000 00000000 00000100 00000413 e5551f00
-
00008000 8001f2d0 0d000000 2f080900 19000000 00000000 00000000 00000100
-
00008e13
-
-
<32 bytes per line>
-
-
BBED> d offset 7040 count 100
-
File: /export/home/oracle/oradata/udotbs02.dbf (6)
-
Block: 121 Offsets: 7040 to 7139 Dba:0x01800079
-
------------------------------------------------------------------------
-
20000000 83008001 aed60d00 0000a187 0900ffff 00000000 00000000 00000000
-
01000000 551fe555 1f000000 80008001 a0d00d00 0000a187 09001800 00000000
-
00000000 00000000 01000000 0413e555 1f000000 80008001 f2d00d00 00002f08
-
09001900
-
-
<32 bytes per line>
-
-
BBED> set file 1 block 9
-
FILE# 1
-
BLOCK# 9
-
-
BBED> map
-
File: /export/home/oracle/oradata/ora10g/system01.dbf (1)
-
Block: 9 Dba:0x00400009
-
------------------------------------------------------------
-
Unlimited Undo Segment Header
-
-
struct kcbh, 20 bytes @0
-
-
struct ktech, 72 bytes @20
-
-
struct ktemh, 16 bytes @92
-
-
struct ktetb[6], 48 bytes @108
-
-
struct ktuxc, 104 bytes @4148
-
-
struct ktuxe[255], 10200 bytes @4252
-
-
ub4 tailchk @8188
-
-
-
BBED> map/v
-
File: /export/home/oracle/oradata/ora10g/system01.dbf (1)
-
Block: 9 Dba:0x00400009
-
------------------------------------------------------------
-
Unlimited Undo Segment Header
-
-
struct kcbh, 20 bytes @0
-
ub1 type_kcbh @0
-
ub1 frmt_kcbh @1
-
ub1 spare1_kcbh @2
-
ub1 spare2_kcbh @3
-
ub4 rdba_kcbh @4
-
ub4 bas_kcbh @8
-
ub2 wrp_kcbh @12
-
ub1 seq_kcbh @14
-
ub1 flg_kcbh @15
-
ub2 chkval_kcbh @16
-
ub2 spare3_kcbh @18
-
-
struct ktech, 72 bytes @20
-
ub4 spare1_ktech @20
-
word tsn_ktech @24
-
ub4 lastmap_ktech @28
-
ub4 mapcount_ktech @32
-
ub4 extents_ktech @36
-
ub4 blocks_ktech @40
-
ub2 mapend_ktech @44
-
struct hwmark_ktech, 32 bytes @48
-
struct locker_ktech, 8 bytes @80
-
ub4 flag_ktech @88
-
-
struct ktemh, 16 bytes @92
-
ub4 count_ktemh @92
-
ub4 next_ktemh @96
-
ub4 obj_ktemh @100
-
ub4 flag_ktemh @104
-
-
struct ktetb[6], 48 bytes @108
-
ub4 ktetbdba @108
-
ub4 ktetbnbk @112
-
-
struct ktuxc, 104 bytes @4148
-
struct ktuxcscn, 8 bytes @4148
-
struct ktuxcuba, 8 bytes @4156
-
sb2 ktuxcflg @4164
-
ub2 ktuxcseq @4166
-
sb2 ktuxcnfb @4168
-
ub4 ktuxcinc @4172
-
sb2 ktuxcchd @4176
-
sb2 ktuxcctl @4178
-
ub2 ktuxcmgc @4180
-
ub4 ktuxcopt @4188
-
struct ktuxcfbp[5], 60 bytes @4192
-
-
struct ktuxe[255], 10200 bytes @4252
-
ub4 ktuxexid @4252
-
ub4 ktuxebrb @4256
-
struct ktuxescn, 8 bytes @4260
-
sb4 ktuxesta @4268
-
ub1 ktuxecfl @4269
-
sb2 ktuxeuel @4270
-
-
ub4 tailchk @8188
-
-
-
BBED> p ktuxe
-
struct ktuxe[0], 40 bytes @4252
-
ub4 ktuxexid @4252 0x0000002e
-
ub4 ktuxebrb @4256 0x0040018f
-
struct ktuxescn, 8 bytes @4260
-
ub4 kscnbas @4260 0x000d1f80
-
ub2 kscnwrp @4264 0x0000
-
sb4 ktuxesta @4268 6225929 (NONE)
-
ub1 ktuxecfl @4269 0x00
-
sb2 ktuxeuel @4270 95
-
struct ktuxe[1], 40 bytes @4292
-
ub4 ktuxexid @4292 0x0000002f
-
ub4 ktuxebrb @4296 0x00400198
-
struct ktuxescn, 8 bytes @4300
-
ub4 kscnbas @4300 0x000dd663
-
ub2 kscnwrp @4304 0x0000
-
sb4 ktuxesta @4308 917513 (NONE)
-
ub1 ktuxecfl @4309 0x00
-
sb2 ktuxeuel @4310 14
-
struct ktuxe[2], 40 bytes @4332
-
ub4 ktuxexid @4332 0x0000002f
-
ub4 ktuxebrb @4336 0x00400198
-
struct ktuxescn, 8 bytes @4340
-
ub4 kscnbas @4340 0x000dd661
-
ub2 kscnwrp @4344 0x0000
-
sb4 ktuxesta @4348 65545 (NONE)
-
ub1 ktuxecfl @4349 0x00
-
sb2 ktuxeuel @4350 1
-
struct ktuxe[3], 40 bytes @4372
-
ub4 ktuxexid @4372 0x0000002e
-
ub4 ktuxebrb @4376 0x0040018f
-
struct ktuxescn, 8 bytes @4380
-
ub4 kscnbas @4380 0x000d1f70
-
ub2 kscnwrp @4384 0x0000
-
sb4 ktuxesta @4388 5898249 (NONE)
-
ub1 ktuxecfl @4389 0x00
-
sb2 ktuxeuel @4390 90
-
struct ktuxe[4], 40 bytes @4412
-
ub4 ktuxexid @4412 0x0000002f
-
ub4 ktuxebrb @4416 0x00400197
-
struct ktuxescn, 8 bytes @4420
-
ub4 kscnbas @4420 0x000d4f82
-
ub2 kscnwrp @4424 0x0000
-
sb4 ktuxesta @4428 4718601 (NONE)
-
ub1 ktuxecfl @4429 0x00
-
sb2 ktuxeuel @4430 72
-
struct ktuxe[5], 40 bytes @4452
-
ub4 ktuxexid @4452 0x0000002f
-
ub4 ktuxebrb @4456 0x00400198
-
struct ktuxescn, 8 bytes @4460
-
ub4 kscnbas @4460 0x000dd655
-
ub2 kscnwrp @4464 0x0000
-
sb4 ktuxesta @4468 5308425 (NONE)
-
ub1 ktuxecfl @4469 0x00
-
sb2 ktuxeuel @4470 81
-
struct ktuxe[6], 40 bytes @4492
-
ub4 ktuxexid @4492 0x0000002e
-
ub4 ktuxebrb @4496 0x0040018e
-
struct ktuxescn, 8 bytes @4500
-
ub4 kscnbas @4500 0x000d1f6a
-
ub2 kscnwrp @4504 0x0000
-
sb4 ktuxesta @4508 1507337 (NONE)
-
ub1 ktuxecfl @4509 0x00
-
sb2 ktuxeuel @4510 23
-
struct ktuxe[7
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21980353/viewspace-1789189/
,如需转载,请注明出处,否则将追究法律责任。