今天有朋友问了我两个关于BBED的问题,我这里回答一下。
1、BBED不能够正常make,报如下错误:
ld: 0706-006 Cannot find or open library file: -l m
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l m
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l m
ld:open(): A file or directory in the path name does not exist.
make: 1254-004 The error code from the last command is 255.
为什么会这样?
答:这是因为缺少bos.adt.libm,如下所示:
$ lslpp -l | grep bos.adt
bos.adt.base
bos.adt.include
bos.adt.lib
正常情况下应该这样:
$ lslpp -l | grep bos.adt
bos.adt.base
bos.adt.debug
bos.adt.graphics
bos.adt.include
bos.adt.insttools
bos.adt.lib
bos.adt.libm
bos.adt.libmio
bos.adt.prof
bos.adt.prt_tools
bos.adt.samples
bos.adt.sccs
bos.adt.syscalls
bos.adt.utils
bos.adt.data
2、BBED里怎样在不看trace文件的情况下知道某一行的offset,或者说定位到这一行?
答:有两种方法,我们来举一个实例:
SQL> select owner,object_name,dbms_rowid.rowid_relative_fno(rowid)||'_'||dbms_rowid.rowid_block_number(rowid) location from sys.testlmttb where rownum<6;
OWNER OBJECT_NAME LOCATION
------- ------------------------------------ -----------------------
SYS /1005bd30_LnkdConstant 138_13
SYS /10076b23_OraCustomDatumClosur 138_13
SYS /
SYS /
SYS /
现在我要在不看dump文件的前提下通过BBED找到上述select结果中的那条蓝色的记录,这条蓝色的记录是第4行。
方法1、直接find:
SQL> select dump('/
DUMP('/
--------------------------------------------------------------------------------
Typ=96 Len=30:
所以这里我们直接find字符串2f31303361326537335f44656661756c74456469746f724b6974456e6450:
BBED> set dba 138,13
DBA 0x2280000d (578813965 138,13)
BBED> find /x
File: /dras20/astca/testlmt01.dbf (138)
Block: 13 Offsets: 7798 to 8191 Dba:0x2280000d
------------------------------------------------------------------------
c
13323030 362d3036 2d
032233ff
32303036 2d30362d
000d0353 59531e
014e014e 014e
74616e74 ff
014e014e 014ec78d 0601
<32 bytes per line>
这里的offset是7798,很容易计算出这一行的行头的offset是7790。
方法2、用kdbr结构定位offset:
上述这条蓝色的记录是第4行,所以这条记录在这个block里的row directory对应的就是kdbr[3]:
BBED> set offset *kdbr[3]
OFFSET 7790
BBED> dump
File: /dras20/astca/testlmt01.dbf (138)
Block: 13 Offsets: 7790 to 8191 Dba:0x2280000d
------------------------------------------------------------------------
6974456e 6450ff
4944014e 014e014e
44014e01 4e014e
30390556
34350556
<32 bytes per line>
BBED> x /r
rowdata[6681] @7790
-------------
flag@7790: 0x
lock@7791: 0x00
cols@7792: 13
col 0[3] @7793: 0x53 0x59 0x53
col 1[30] @7797: 0x
0x44 0x65 0x66 0x61 0x75 0x
0x4b 0x69 0x74 0x45 0x6e 0x64 0x50
col 2[0] @7828: *NULL*
col 3[4] @7829: 0xc3 0x02 0x
col 4[0] @7834: *NULL*
col 5[10] @7835: 0x
col 6[7] @7846: 0x78 0x
col 7[7] @7854: 0x78 0x
col 8[19] @7862: 0x32 0x30 0x30 0x36 0x2d 0x30 0x36 0x2d 0x31 0x39
0x
col 9[5] @7882: 0x56 0x41 0x
col 10[1] @7888: 0x4e
col 11[1] @7890: 0x4e
col 12[1] @7892: 0x4e
从结果里我们可以看到,上述行的行头的offset确实是7790。
我发现好像有不少朋友都对BBED很感兴趣,其实我觉得BBED真没什么,就是一个工具而已,用ultraEdit+dd往往可以达到同样的目的(当然,会麻烦一些)。
用好BBED的关键就是要了解Block的结构。
Leave a comment