[20230224]bbed設定偏移技巧.txt

lfree發表於2023-02-24

[20230224]bbed設定偏移技巧.txt

--//我使用bbed設定偏移一般喜歡使用數字,實際上可以直接使用symbol或者*symbol定位,透過一些例子測試以及說明:

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.測試:
SCOTT@book> select rowid,dept.* from dept where rownum<=1;
ROWID                  DEPTNO DNAME          LOC
------------------ ---------- -------------- -------------
AAAVRCAAEAAAACHAAA         10 ACCOUNTING     NEW YORK

SCOTT@book> @ rowid AAAVRCAAEAAAACHAAA
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
     87106          4        135          0  0x1000087           4,135                alter system dump datafile 4 block 135 ;

3.bbed設定偏移:

BBED> help set
SET DBA [ dba | file#, block# ]
SET FILENAME 'filename'
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET BLOCKSIZE bytes
SET LIST[FILE] 'filename'
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE  [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
--//從幫助也可以看出支援symbol , *symbol.

BBED> set dba 4,135
        DBA             0x01000087 (16777351 4,135)

BBED> map
 File: /mnt/ramdisk/book/users01.dbf (4)
 Block: 135                                   Dba:0x01000087
------------------------------------------------------------
 KTB Data Block (Table/Cluster)
 struct kcbh, 20 bytes                      @0
 struct ktbbh, 72 bytes                     @20
 struct kdbh, 14 bytes                      @100
 struct kdbt[1], 4 bytes                    @114
 sb2 kdbr[4]                                @118
 ub1 freespace[7970]                        @126
 ub1 rowdata[92]                            @8096
 ub4 tailchk                                @8188

BBED> set offset kdbr
        OFFSET          118
--//設定偏移118.

BBED> p kdbr
sb2 kdbr[0]                                 @118      8062
sb2 kdbr[1]                                 @120      8040
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sb2 kdbr[2]                                 @122      8020
sb2 kdbr[3]                                 @124      7996

BBED> set offset kdbr[1]
        OFFSET          120

BBED> set offset *kdbr[5]
BBED-00401: out of range array index (5)

BBED> x   /rncc *kdbr[1]
rowdata[44]                                 @8140
-----------
flag@8140: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8141: 0x00
cols@8142:    3

col    0[2] @8143: 20
col    1[8] @8146: RESEARCH
col    2[6] @8155: DALLAS
--//注意: p kdbr 顯示的相對偏移 要加上kdbh地址的偏移才是絕對偏移,這裡也就是100.

BBED> set offset *kdbr[1]
        OFFSET          8140

--//8140也是正確的.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2936974/,如需轉載,請註明出處,否則將追究法律責任。

相關文章