联系:QQ(5163721)
标题:global_name为空导致的数据库不能open—使用BBED修复(bbed恢复update的数据)
作者:Lunar©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]
GLOBAL_NAME和props$对象介绍
global_name为空导致的数据库不能open—–使用gdb修复(中断oracle启动的部分监测功能)
global_name为空导致的数据库不能open—–使用dd修复(使用dd拷贝块的方式)
global_name为空导致的数据库不能open—–使用DUL修复
这篇为第4种解决 global_name 为NULL导致数据库不能启动的方法—-本质是使用bbed来恢复update的值。
bbed的安装和配置,网上已经很多了,总的来说,就是12.1和11.2都使用10.2的bbed库进行编译,然后可以正常使用。
bbed的初始配置参考: BBED简介
即,使用BBED来直接修改一个block的数据的方法。这里将使用BBED将删除掉global_name值找回来。
注意: 这个方法实质就是使用BBED恢复一行被update的数据。
上次我们说过,很多方法都可以定位这个报错的数据块和global_name所在行的信息。
在中《global_name为空导致的数据库不能open—–使用DUL修复》,我们使用对比的方法。
这里,我们根据报错时生成的trace文件来定位这行报错的global_name在block中信息,然后使用bbed来修复。
首先,我们知道props$的数据存放在file 1 block 801中,那么转换存储地址为:
SYS@lunarp>select to_char(dbms_utility.make_data_block_address(1,801),'xxxxxxxxxxxxxxxxx') from dual; TO_CHAR(DBMS_UTILI ------------------ 400321 Elapsed: 00:00:00.01 SYS@lunarp>
在bbed中验证一下,我们看到改块内共36行数据,这个信息在11.2的数据库中是固定的(缺省情况下,也就是没有手工修改时):
BBED> set file 1 block 801 FILE# 1 BLOCK# 801 BBED> p kdbh struct kdbh, 14 bytes @92 ub1 kdbhflag @92 0x00 (NONE) sb1 kdbhntab @93 1 sb2 kdbhnrow @94 36 该表有36行 sb2 kdbhfrre @96 -1 sb2 kdbhfsbo @98 90 sb2 kdbhfseo @100 5852 sb2 kdbhavsp @102 6040 sb2 kdbhtosp @104 6040 BBED>
那么,这行记录到底是第几行呢? 使用bbed的find自然是可以search到,不过这个方法感觉不清晰。
下面,我们在trace中,搜索“0x00400321”关键字,找到“Block header dump: 0x00400321”相关部分:
Block header dump: 0x00400321 Object id on Block? Y seg/obj: 0x62 csc: 0x00.1a0169 itc: 2 flg: O typ: 1 - DATA fsl: 0 fnx: 0x0 ver: 0x01 Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x0007.006.00000346 0x00c00f60.00ad.31 --U- 1 fsc 0x0007.001a988c 0x02 0x0001.01a.00000322 0x00c00ee0.009b.0e C--- 0 scn 0x0000.0019b316 bdba: 0x00400321 data_block_dump,data header at 0x76fa205c =============== tsiz: 0x1fa0 hsiz: 0x5a pbl: 0x76fa205c 76543210 flag=-------- ntab=1 nrow=36 frre=-1 fsbo=0x5a fseo=0x16b4 avsp=0x1798 tosp=0x179f 0xe:pti[0] nrow=36 offs=0 0x12:pri[0] offs=0x1f70 0x14:pri[1] offs=0x1e57 0x16:pri[2] offs=0x1894 0x18:pri[3] offs=0x1e9c 0x1a:pri[4] offs=0x1e10 0x1c:pri[5] offs=0x1dfb 0x1e:pri[6] offs=0x1dd9 0x20:pri[7] offs=0x1d98 0x22:pri[8] offs=0x1d55 0x24:pri[9] offs=0x1d0f 0x26:pri[10] offs=0x1cd9 0x28:pri[11] offs=0x1cb7 0x2a:pri[12] offs=0x1c94 0x2c:pri[13] offs=0x1c73 0x2e:pri[14] offs=0x1c4a 0x30:pri[15] offs=0x1c1a 0x32:pri[16] offs=0x1bef 0x34:pri[17] offs=0x1bc5 0x36:pri[18] offs=0x1b9c 0x38:pri[19] offs=0x1b70 0x3a:pri[20] offs=0x1b47 0x3c:pri[21] offs=0x1b19 0x3e:pri[22] offs=0x1ad6 0x40:pri[23] offs=0x1a93 0x42:pri[24] offs=0x1a3c 0x44:pri[25] offs=0x1a10 0x46:pri[26] offs=0x19ee 0x48:pri[27] offs=0x19bc 0x4a:pri[28] offs=0x1986 0x4c:pri[29] offs=0x194e 0x4e:pri[30] offs=0x190d 0x50:pri[31] offs=0x16b4 0x52:pri[32] offs=0x1862 0x54:pri[33] offs=0x1818 0x56:pri[34] offs=0x179c 0x58:pri[35] offs=0x1760
seg/obj: 0x62 转换成10进制是98,也就是对象号98(dba_objects.object_id=98),这个正式props$对象的object_id:
csc: 0x00.18c0ef –cleanoutSCN,块清除时的SCN
itc: 2 —ITLcount, ITL的数量
flg: O —Block is on free list (flg)
typ: 1 – DATA —-这里表示是数据块,定义如下:
接下来是ITL信息:
Itl Xid Uba Flag Lck Scn/Fsc 0x01 0x000a.01f.00000333 0x00c00995.00ac.2f --U- 1 fsc 0x0005.0018c0f4 0x02 0x0003.00f.0000031e 0x00c007c8.00a5.05 C--- 0 scn 0x0000.001052a5 bdba: 0x00400321 data_block_dump,data header at 0x76fa005c
这里面表示使用了2个ITL slot(跟上面itc: 2是对应的),每个ITL占用24 bytes。
Flag的含义:C是提交,U是快速提交,—是未提交。因此,这里表示没有活动事务,所有事物都已经commit
上述信息跟bbed的信息是吻合的:
BBED> p ktbbh struct ktbbh, 72 bytes @20 ub1 ktbbhtyp @20 0x01 (KDDBTDATA) union ktbbhsid, 4 bytes @24 ub4 ktbbhsg1 @24 0x00000062 ub4 ktbbhod1 @24 0x00000062 struct ktbbhcsc, 8 bytes @28 ub4 kscnbas @28 0x001a0169 ub2 kscnwrp @32 0x0000 sb2 ktbbhict @36 2 ub1 ktbbhflg @38 0x03 (KTBFONFL) ub1 ktbbhfsl @39 0x00 ub4 ktbbhfnx @40 0x00000000 struct ktbbhitl[0], 24 bytes @44 struct ktbitxid, 8 bytes @44 ub2 kxidusn @44 0x0007 ub2 kxidslt @46 0x0006 ub4 kxidsqn @48 0x00000346 struct ktbituba, 8 bytes @52 ub4 kubadba @52 0x00c00f60 -----第1个ITL使用的undo block地址 ub2 kubaseq @56 0x00ad ub1 kubarec @58 0x31 ------undo record# ub2 ktbitflg @60 0x2001 (KTBFUPB) ------ union _ktbitun, 2 bytes @62 sb2 _ktbitfsc @62 7 ub2 _ktbitwrp @62 0x0007 ub4 ktbitbas @64 0x001a988c -----对应于fsc(fsc 0x0005.0018c0f4 ) struct ktbbhitl[1], 24 bytes @68 struct ktbitxid, 8 bytes @68 ub2 kxidusn @68 0x0001 ub2 kxidslt @70 0x001a ub4 kxidsqn @72 0x00000322 struct ktbituba, 8 bytes @76 ub4 kubadba @76 0x00c00ee0 -----第2个ITL使用的undo block地址 ub2 kubaseq @80 0x009b ub1 kubarec @82 0x0e ------undo record# ub2 ktbitflg @84 0x8000 (KTBFCOM) ------表示事物已经提交 union _ktbitun, 2 bytes @86 sb2 _ktbitfsc @86 0 ub2 _ktbitwrp @86 0x0000 ub4 ktbitbas @88 0x0019b316 BBED>
使用dump函数可以看到GLOBAL_DB_NAME的16进制形式是:47 4c 4f 42 41 4c 5f 44 42 5f 4e 41 4d 45
按照关键字“47 4c 4f 42 41 4c 5f 44 42 5f 4e 41 4d 45” 搜索trace文件,可以看到:
tab 0, row 31, @0x16b4 -------》表示: 第1张表,第32行(从0开始编号)数据,块内偏移量为:5812 bytes tl: 40 fb: --H-FL-- lb: 0x1 cc: 3 col 0: [14] 47 4c 4f 42 41 4c 5f 44 42 5f 4e 41 4d 45 col 1: *NULL* col 2: [20] 47 6c 6f 62 61 6c 20 64 61 74 61 62 61 73 65 20 6e 61 6d 65
我们来证实一下,是不是这样数据。
这里显示global_name对应的是第32行数据(一个block中的数据行是从0开始编号的)。
我们证实一下,首先,这里col 0:
SYS@lunarp>select utl_raw.cast_to_varchar2(replace('47 4c 4f 42 41 4c 5f 44 42 5f 4e 41 4d 45',' ','')) from dual; UTL_RAW.CAST_TO_VARCHAR2(REPLACE('474C4F42414C5F44425F4E414D45','','')) ------------------------------------------------------------------------------------------------------------------------------------------------------ GLOBAL_DB_NAME Elapsed: 00:00:00.01 SYS@lunarp> col 1 这个是第二列,value$的值,被update为空值了。 col 2: SYS@lunarp>select utl_raw.cast_to_varchar2(replace('47 6c 6f 62 61 6c 20 64 61 74 61 62 61 73 65 20 6e 61 6d 65',' ','')) from dual; UTL_RAW.CAST_TO_VARCHAR2(REPLACE('476C6F62616C206461746162617365206E616D65','','')) ------------------------------------------------------------------------------------------------------------------------------------------------------ Global database name Elapsed: 00:00:00.01 SYS@lunarp>
可以看到,跟我们前面看到的是一致的:
SYS@lunarp>select * from props$ where name = 'GLOBAL_DB_NAME'; NAME VALUE$ COMMENT$ ------------------------------ ------------------------------ -------------------------------------------------- GLOBAL_DB_NAME Global database name Elapsed: 00:00:00.01 SYS@lunarp>
那么这行数据在块内偏移量:
SYS@lunarp>select to_number(’16b4′,’xxxxxxxxxxxx’) from dual;
TO_NUMBER(’16b4′,’XXXXXXXXXXXX’)
——————————–
5812
Elapsed: 00:00:00.00
SYS@lunarp>
普通行头:ROW_HEAD_PIECE + ROW_FIRST_PIECE + ROW_LAST_PIECE= 0x20 + 0x08 + 0x04= 0x2c 转换成10进制就是44
第32行记录的实际位置应该是:5812+44+2*24=5904
BBED> d /v offset 5908 count 128
File: /stage/lunar/system01.dbf (1)
Block: 801 Offsets: 5908 to 6035 Dba:0x00400321
——————————————————-
474c4f42 414c5f44 425f4e41 4d45ff14 l GLOBAL_DB_NAME..
476c6f62 616c2064 61746162 61736520 l Global database
6e616d65 2c00030e 474c4f42 414c5f44 l name,…GLOBAL_D
425f4e41 4d45076c 756e6172 62621447 l B_NAME.lunarbb.G
6c6f6261 6c206461 74616261 7365206e l lobal database n
616d652c 00030e47 4c4f4241 4c5f4442 l ame,…GLOBAL_DB
5f4e414d 45ff1447 6c6f6261 6c206461 l _NAME..Global da
74616261 7365206e 616d652c 00030e47 l tabase name,…G
<16 bytes per line>
BBED>
查看第32行数据(从第0行开始编号):
BBED> p *kdbr[31]
rowdata[0]
———-
ub1 rowdata[0] @5904 0x2c
BBED> x /rccccccccc
rowdata[0] @5904
———-
flag@5904: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5905: 0x01
cols@5906: 3
col 0[14] @5907: GLOBAL_DB_NAME
col 1[0] @5922: *NULL*
col 2[20] @5923: Global database name
BBED>
[/shell]
可以看到,信息都是对的,GLOBAL_NAME的值是*NULL*,表示已经被清空了。
现在我们需要找到update之前的值。在block中按照GLOBAL_DB_NAME关键字检索,因为我使用多个方法分别update了多次,因此我这里搜索出来5次:
BBED> find /c GLOBAL_DB_NAME File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5908 to 6035 Dba:0x00400321 ------------------------------------------------------------------------ 474c4f42 414c5f44 425f4e41 4d45ff14 476c6f62 616c2064 61746162 61736520 6e616d65 2c00030e 474c4f42 414c5f44 425f4e41 4d45076c 756e6172 62621447 6c6f6261 6c206461 74616261 7365206e 616d652c 00030e47 4c4f4241 4c5f4442 5f4e414d 45ff1447 6c6f6261 6c206461 74616261 7365206e 616d652c 00030e47 <32 bytes per line> BBED> f File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5948 to 6075 Dba:0x00400321 ------------------------------------------------------------------------ 474c4f42 414c5f44 425f4e41 4d45076c 756e6172 62621447 6c6f6261 6c206461 74616261 7365206e 616d652c 00030e47 4c4f4241 4c5f4442 5f4e414d 45ff1447 6c6f6261 6c206461 74616261 7365206e 616d652c 00030e47 4c4f4241 4c5f4442 5f4e414d 45054c55 4e415214 476c6f62 616c2064 61746162 61736520 6e616d65 <32 bytes per line> BBED> f File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5995 to 6122 Dba:0x00400321 ------------------------------------------------------------------------ 474c4f42 414c5f44 425f4e41 4d45ff14 476c6f62 616c2064 61746162 61736520 6e616d65 2c00030e 474c4f42 414c5f44 425f4e41 4d45054c 554e4152 14476c6f 62616c20 64617461 62617365 206e616d 652c0002 174e4f5f 55534552 49445f56 45524946 4945525f 53414c54 20364135 38323032 41303638 42363738 42303943 <32 bytes per line> BBED> f File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 6035 to 6162 Dba:0x00400321 ------------------------------------------------------------------------ 474c4f42 414c5f44 425f4e41 4d45054c 554e4152 14476c6f 62616c20 64617461 62617365 206e616d 652c0002 174e4f5f 55534552 49445f56 45524946 4945525f 53414c54 20364135 38323032 41303638 42363738 42303943 46353731 44433936 37463345 432c0003 14574f52 4b4c4f41 445f5245 504c4159 5f4d4f44 45ff6250 <32 bytes per line> BBED> f File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 6463 to 6590 Dba:0x00400321 ------------------------------------------------------------------------ 474c4f42 414c5f44 425f4e41 4d450654 52415645 4c14476c 6f62616c 20646174 61626173 65206e61 6d652c00 03114e4c 535f5244 424d535f 56455253 494f4e0a 31312e32 2e302e33 2e302052 44424d53 20766572 73696f6e 20666f72 204e4c53 20706172 616d6574 6572732c 0003164e 4c535f4e 43484152 5f434841 52414354 <32 bytes per line> BBED> f BBED-00212: search string not found
为了看得更清晰,我们看看这5次搜索到的具体的内容:
看一下上述5次修改的值分别是什么:
BBED> d /v offset 5908 count 100 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5908 to 6007 Dba:0x00400321 ------------------------------------------------------- 474c4f42 414c5f44 425f4e41 4d45ff14 l GLOBAL_DB_NAME.. 476c6f62 616c2064 61746162 61736520 l Global database 6e616d65 2c00030e 474c4f42 414c5f44 l name,...GLOBAL_D ------ 2c00030e =======》行头 行起始的offset:5944 425f4e41 4d45076c 756e6172 62621447 l B_NAME.lunarbb.G 6c6f6261 6c206461 74616261 7365206e l lobal database n 616d652c 00030e47 4c4f4241 4c5f4442 l ame,...GLOBAL_DB 5f4e414d l _NAM <16 bytes per line> BBED> d /v offset 5948 count 100 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5948 to 6047 Dba:0x00400321 ------------------------------------------------------- 474c4f42 414c5f44 425f4e41 4d45076c l GLOBAL_DB_NAME.l ----- 474c4f42 414c5f44 425f4e41 4d45 ====>GLOBAL_DB_NAME 756e6172 62621447 6c6f6261 6c206461 l unarbb.Global da ------- 6c 756e6172 6262 =========> lunarbb 74616261 7365206e 616d652c 00030e47 l tabase name,...G ----- 47 6c6f6261 6c206461 74616261 7365206e 616d65 =====》 Global database name 4c4f4241 4c5f4442 5f4e414d 45ff1447 l LOBAL_DB_NAME..G --- 2c 00030e =========>行头 行起始的offset:5991 6c6f6261 6c206461 74616261 7365206e l lobal database n 616d652c 00030e47 4c4f4241 4c5f4442 l ame,...GLOBAL_DB 5f4e414d l _NAM <16 bytes per line> BBED> d /v offset 5995 count 100 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5995 to 6094 Dba:0x00400321 ------------------------------------------------------- 474c4f42 414c5f44 425f4e41 4d45ff14 l GLOBAL_DB_NAME.. 476c6f62 616c2064 61746162 61736520 l Global database 6e616d65 2c00030e 474c4f42 414c5f44 l name,...GLOBAL_D 425f4e41 4d45054c 554e4152 14476c6f l B_NAME.LUNAR.Glo 62616c20 64617461 62617365 206e616d l bal database nam 652c0002 174e4f5f 55534552 49445f56 l e,...NO_USERID_V 45524946 l ERIF <16 bytes per line> BBED> d /v offset 6035 count 100 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 6035 to 6134 Dba:0x00400321 ------------------------------------------------------- 474c4f42 414c5f44 425f4e41 4d45054c l GLOBAL_DB_NAME.L 554e4152 14476c6f 62616c20 64617461 l UNAR.Global data 62617365 206e616d 652c0002 174e4f5f l base name,...NO_ ---- 476c6f 62616c20 64617461 62617365 206e616d 65 =====》 Global database name 55534552 49445f56 45524946 4945525f l USERID_VERIFIER_ ----- 2c0002 17 =========>行头 行起始的offset:6076 53414c54 20364135 38323032 41303638 l SALT 6A58202A068 42363738 42303943 46353731 44433936 l B678B09CF571DC96 37463345 l 7F3E <16 bytes per line> BBED> d /v offset 6463 count 100 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 6463 to 6562 Dba:0x00400321 ------------------------------------------------------- 474c4f42 414c5f44 425f4e41 4d450654 l GLOBAL_DB_NAME.T 52415645 4c14476c 6f62616c 20646174 l RAVEL.Global dat 61626173 65206e61 6d652c00 03114e4c l abase name,...NL 535f5244 424d535f 56455253 494f4e0a l S_RDBMS_VERSION. 31312e32 2e302e33 2e302052 44424d53 l 11.2.0.3.0 RDBMS 20766572 73696f6e 20666f72 204e4c53 l version for NLS 20706172 l par <16 bytes per line> BBED>
当前row[31]的信息如下:
BBED> p kdbr[31] sb2 kdbr[31] @172 5812 BBED> p *kdbr[31] rowdata[0] ---------- ub1 rowdata[0] @5904 0x2c BBED> x /rccccccccccccccc rowdata[0] @5904 ---------- flag@5904: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@5905: 0x01 cols@5906: 3 col 0[14] @5907: GLOBAL_DB_NAME col 1[0] @5922: *NULL* col 2[20] @5923: Global database name
上面5次的详细信息:
BBED> d /v offset 5904 count 100 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5904 to 6003 Dba:0x00400321 ------------------------------------------------------- 2c01030e 474c4f42 414c5f44 425f4e41 l ,...GLOBAL_DB_NA --- 2c01030e =========>行头 4d45ff14 476c6f62 616c2064 61746162 l ME..Global datab ---- global_name=NULL 61736520 6e616d65 2c00030e 474c4f42 l ase name,...GLOB --- 2c01030e =========>行头 offset 5944 414c5f44 425f4e41 4d45076c 756e6172 l AL_DB_NAME.lunar ---- global_name=lunarbb 62621447 6c6f6261 6c206461 74616261 l bb.Global databa 7365206e 616d652c 00030e47 4c4f4241 l se name,...GLOBA 4c5f4442 l L_DB <16 bytes per line> BBED> dump /v offset 5944 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5944 to 6043 Dba:0x00400321 ------------------------------------------------------- 2c00030e 474c4f42 414c5f44 425f4e41 l ,...GLOBAL_DB_NA ----- 2c01030e =========>行头 offset 5944 4d45076c 756e6172 62621447 6c6f6261 l ME.lunarbb.Globa ---- global_name=lunarbb 6c206461 74616261 7365206e 616d652c l l database name, 00030e47 4c4f4241 4c5f4442 5f4e414d l ...GLOBAL_DB_NAM 45ff1447 6c6f6261 6c206461 74616261 l E..Global databa 7365206e 616d652c 00030e47 4c4f4241 l se name,...GLOBA 4c5f4442 l L_DB <16 bytes per line> BBED> dump /v offset 5991 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 5991 to 6090 Dba:0x00400321 ------------------------------------------------------- 2c00030e 474c4f42 414c5f44 425f4e41 l ,...GLOBAL_DB_NA ---- 2c01030e =========>行头 offset 5991 4d45ff14 476c6f62 616c2064 61746162 l ME..Global datab ---- global_name=NULL 61736520 6e616d65 2c00030e 474c4f42 l ase name,...GLOB ---- 2c01030e =========>行头 offset 6031 414c5f44 425f4e41 4d45054c 554e4152 l AL_DB_NAME.LUNAR ---- global_name=NULL 14476c6f 62616c20 64617461 62617365 l .Global database 206e616d 652c0002 174e4f5f 55534552 l name,...NO_USER 49445f56 l ID_V <16 bytes per line> BBED> dump /v offset 6031 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 6031 to 6130 Dba:0x00400321 ------------------------------------------------------- 2c00030e 474c4f42 414c5f44 425f4e41 l ,...GLOBAL_DB_NA ---- 2c01030e =========>行头 offset 6031 4d45054c 554e4152 14476c6f 62616c20 l ME.LUNAR.Global ---- global_name=LUNAR 64617461 62617365 206e616d 652c0002 l database name,.. 174e4f5f 55534552 49445f56 45524946 l .NO_USERID_VERIF 4945525f 53414c54 20364135 38323032 l IER_SALT 6A58202 41303638 42363738 42303943 46353731 l A068B678B09CF571 44433936 l DC96 <16 bytes per line> BBED>
我们可以选择这行数据指向6031(GLOBAL_DB_NAME.LUNAR),也可以选择这行数据指向5944(GLOBAL_DB_NAME.lunarbb)。
这里,我们选择将global_name修改会LUNAR,也就是将global_name还原为update之前的为LUNAR值。
现在我们把 *kdbr[31](即 rowdata的指针)的指针指向 offset 6031:
由于kdbr[31]和*kdbr[30]之间的差为92:*kdbr[31]的offset-kdbr[31]的offset=5904-5812=92
因此,要想*kdbr[31]指向6031,需要将kdbr[31]的值改为: 6031-92=5939(16进制为1733,考虑linux的倒序,实际修改时应该是3317)
修改前:
BBED> p kdbr[31] sb2 kdbr[31] @172 5812 BBED> p *kdbr[31] rowdata[0] ---------- ub1 rowdata[0] @5904 0x2c BBED> x /rccccccccccccccc rowdata[0] @5904 ---------- flag@5904: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@5905: 0x01 cols@5906: 3 col 0[14] @5907: GLOBAL_DB_NAME col 1[0] @5922: *NULL* col 2[20] @5923: Global database name BBED> set offset 172 OFFSET 172 BBED> dump File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 172 to 271 Dba:0x00400321 ------------------------------------------------------------------------ b4166218 18189c17 60170000 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>
——5812转换成16进制是16B4,linux是little endian,因此offset中实际上是保存了b416,也就是指向了b416这个位置
修改后:
BBED> modify /x 3317 offset 172 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 172 to 271 Dba:0x00400321 ------------------------------------------------------------------------ 33176218 18189c17 60170000 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> dump /v offset 172 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 172 to 271 Dba:0x00400321 ------------------------------------------------------- 33176218 18189c17 60170000 00000000 l 3.b.....`....... 00000000 00000000 00000000 00000000 l ................ 00000000 00000000 00000000 00000000 l ................ 00000000 00000000 00000000 00000000 l ................ 00000000 00000000 00000000 00000000 l ................ 00000000 00000000 00000000 00000000 l ................ 00000000 l .... <16 bytes per line> BBED> p kdbr[31] sb2 kdbr[31] @172 5939 BBED> p *kdbr[31] rowdata[127] ------------ ub1 rowdata[127] @6031 0x2c BBED> x /rccccccccccc rowdata[127] @6031 ------------ flag@6031: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@6032: 0x00 cols@6033: 3 col 0[14] @6034: GLOBAL_DB_NAME col 1[5] @6049: LUNAR col 2[20] @6055: Global database name BBED> sum apply Check value for File 1, Block 801: current = 0x93f1, required = 0x93f1
验证报错:kdbchk: xaction header lock count mismatch
BBED> verify DBVERIFY - Verification starting FILE = /stage/lunar/system01.dbf BLOCK = 801 Block Checking: DBA = 4195105, Block Type = KTB-managed data block data header at 0xf3465c kdbchk: xaction header lock count mismatch trans=1 ilk=1 nlo=0 Block 801 failed with check code 6108 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 Message 531 not found; product=RDBMS; facility=BBED BBED>
这里的错误信息“kdbchk: xaction header lock count mismatch”,对比修改前后的lock信息,就知道应该修改lock值:
BBED> modify /x 01 offset 6032 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 6032 to 6131 Dba:0x00400321 ------------------------------------------------------------------------ 01030e47 4c4f4241 4c5f4442 5f4e414d 45054c55 4e415214 476c6f62 616c2064 61746162 61736520 6e616d65 2c000217 4e4f5f55 53455249 445f5645 52494649 45525f53 414c5420 36413538 32303241 30363842 36373842 30394346 35373144 43393637 <32 bytes per line> BBED> sum apply Check value for File 1, Block 801: current = 0x93f0, required = 0x93f0 BBED> verify DBVERIFY - Verification starting FILE = /stage/lunar/system01.dbf BLOCK = 801 Block Checking: DBA = 4195105, Block Type = KTB-managed data block data header at 0xf3465c kdbchk: the amount of space used is not equal to block size used=2054 fsc=7 avsp=6040 dtl=8096 Block 801 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 Message 531 not found; product=RDBMS; facility=BBED BBED>
这里报错信息为空间计算(修改可用空间,及其开始偏移量及其结束偏移量):
used+fsc+avsp=2054+7+6040=8101 ,已经大于dtl(8096)了
8101-8086=5
修改 ktbbhitl[1].b2 _ktbitfsc 值为 0就可以了:
修改前:
BBED> p ktbbhitl[0] struct ktbbhitl[0], 24 bytes @44 struct ktbitxid, 8 bytes @44 ub2 kxidusn @44 0x0007 ub2 kxidslt @46 0x0006 ub4 kxidsqn @48 0x00000346 struct ktbituba, 8 bytes @52 ub4 kubadba @52 0x00c00f60 ub2 kubaseq @56 0x00ad ub1 kubarec @58 0x31 ub2 ktbitflg @60 0x2001 (KTBFUPB) union _ktbitun, 2 bytes @62 sb2 _ktbitfsc @62 7 ================需要将这里修改为0 ub2 _ktbitwrp @62 0x0007 ub4 ktbitbas @64 0x001a988c
修改:
BBED> dump /v offset 102 count 8 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 102 to 109 Dba:0x00400321 ------------------------------------------------------- 98179f17 00002400 l ......$. <16 bytes per line> BBED> dump /v offset 104 count 8 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 104 to 111 Dba:0x00400321 ------------------------------------------------------- 9f170000 2400701f l ....$.p. <16 bytes per line> BBED> modify /x 00 offset 62 File: /stage/lunar/system01.dbf (1) Block: 801 Offsets: 62 to 69 Dba:0x00400321 ------------------------------------------------------------------------ 00008c98 1a000100 <32 bytes per line> BBED> sum apply Check value for File 1, Block 801: current = 0x93f7, required = 0x93f7 BBED> p ktbbhitl struct ktbbhitl[0], 24 bytes @44 struct ktbitxid, 8 bytes @44 ub2 kxidusn @44 0x0007 ub2 kxidslt @46 0x0006 ub4 kxidsqn @48 0x00000346 struct ktbituba, 8 bytes @52 ub4 kubadba @52 0x00c00f60 ub2 kubaseq @56 0x00ad ub1 kubarec @58 0x31 ub2 ktbitflg @60 0x2001 (KTBFUPB) union _ktbitun, 2 bytes @62 sb2 _ktbitfsc @62 0 ub2 _ktbitwrp @62 0x0000 ub4 ktbitbas @64 0x001a988c struct ktbbhitl[1], 24 bytes @68 struct ktbitxid, 8 bytes @68 ub2 kxidusn @68 0x0001 ub2 kxidslt @70 0x001a ub4 kxidsqn @72 0x00000322 struct ktbituba, 8 bytes @76 ub4 kubadba @76 0x00c00ee0 ub2 kubaseq @80 0x009b ub1 kubarec @82 0x0e ub2 ktbitflg @84 0x8000 (KTBFCOM) union _ktbitun, 2 bytes @86 sb2 _ktbitfsc @86 0 ub2 _ktbitwrp @86 0x0000 ub4 ktbitbas @88 0x0019b316 BBED>
报错:the amount of space used is not equal to block size 这个很好解决:
BBED> verify DBVERIFY - Verification starting FILE = /stage/lunar/system01.dbf BLOCK = 801 Block Checking: DBA = 4195105, Block Type = KTB-managed data block data header at 0xf5665c kdbchk: the amount of space used is not equal to block size used=2054 fsc=0 avsp=6040 dtl=8096 Block 801 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 Message 531 not found; product=RDBMS; facility=BBED BBED> p kdbh struct kdbh, 14 bytes @92 ub1 kdbhflag @92 0x00 (NONE) sb1 kdbhntab @93 1 sb2 kdbhnrow @94 36 sb2 kdbhfrre @96 -1 sb2 kdbhfsbo @98 90 sb2 kdbhfseo @100 5812 sb2 kdbhavsp @102 6040 sb2 kdbhtosp @104 6047 BBED>
2054+6040=8094 都改好了,现在启动数据库,ok了:
SYS@lunarp>startup
Welcome Lunar's oracle world!
Love you , baby !
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 243271000 bytes
Database Buffers 373293056 bytes
Redo Buffers 7532544 bytes
Database mounted.
Welcome Lunar's oracle world!
Love you , baby !
Database opened.
SYS@lunarp>