[20171124]bbed的使用问题2.txt
--//bbed 是探究oracle数据块的好工具,有时候不用转储,直接可以它看oracle内部块的内部结构.
--//在使用中要注意一些问题,昨天又犯类似错误,通过例子来说明:
SCOTT@book> select rowid,dept.* from dept;
ROWID DEPTNO DNAME LOC
------------------ ---------- -------------- -------------
AAAVRCAAEAAAACHAAA 10 ACCOUNTING NEW YORK
AAAVRCAAEAAAACHAAB 20 RESEARCH DALLAS
AAAVRCAAEAAAACHAAC 30 SALES CHICAGO
AAAVRCAAEAAAACHAAD 40 OPERATIONS BOSTON
SCOTT@book> @ &r/rowid AAAVRCAAEAAAACHAAA
OBJECT FILE BLOCK ROW ROWID_DBA DBA TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
87106 4 135 0 0x1000087 4,135 alter system dump datafile 4 block 135 ;
SCOTT@book> select OWNER,SEGMENT_NAME,SEGMENT_TYPE,HEADER_FILE,HEADER_BLOCK from dba_segments where owner=user and segment_name='DEPT';
OWNER SEGMENT_NAME SEGMENT_TYPE HEADER_FILE HEADER_BLOCK
------ -------------------- ------------------ ----------- ------------
SCOTT DEPT TABLE 4 130
--//我曾经提到过:
--//如果我执行如下类似命令:
BBED> p tailchk dba 4,131
ub4 tailchk @8188 0x0ee40602
BBED> p tailchk dba 4,130
BBED-00400: invalid blocktype (35)
BBED> p tailchk dba 4,131
BBED-00400: invalid blocktype (35)
--//我当时使用的方法是首先输入dba在前面.对于上面的命令你可以理解如下:
BBED> set dba 4,131
DBA 0x01000083 (16777347 4,131)
BBED> p tailchk dba 4,130
BBED-00400: invalid blocktype (35)
BBED> show all
FILE# 4
BLOCK# 130
OFFSET 8188
DBA 0x01000082 (16777346 4,130)
FILENAME /mnt/ramdisk/book/users01.dbf
BIFILE bifile.bbd
LISTFILE /home/oracle/bbed/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 160
COUNT 64
LOGFILE log.bbd
SPOOL Yes
--//注意看show all现在显示的FILE#=4,BLOCK#=130.
BBED> p tailchk dba 4,131
BBED-00400: invalid blocktype (35)
--//当你再输入p tailchk dba 4,131时,实际上先访问dba 4,130,再去访问dba 4,131.
--//如果dba 4,130访问异常,就不会访问dba 4,131.执行出错.
BBED> p dba 4,131 tailchk
ub4 tailchk @8188 0x0ee40602
--//我感觉bbed的执行方式最好按照帮助提示的要求输入参数.这样一般不会错.
--//比如显示P命令的执行方式:
BBED> help p
PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
--//最好按照显示参数的顺序输入基本没有问题,输入如下:
BBED> p dba 4,131 tailchk
ub4 tailchk @8188 0x0ee40602
--//可以直接读访问dba 4,131的tailchk.
BBED> p /d dba 4,131 tailchk
ub4 tailchk @8188 249824770
BBED> p filename '/mnt/ramdisk/book/users01.dbf' block 131 tailchk
ub4 tailchk @8188 0x0ee40602
--//如果写成如下:
BBED> p filename '/mnt/ramdisk/book/users01.dbf' tailchk block 131
ub4 tailchk @0 0x0000a206
--//我根本不知道访问的是那个块.
--//dump也有类似的命令输入方式:
BBED> help dump
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
BBED> dump /v filename '/mnt/ramdisk/book/users01.dbf' block 131 offset 0 count 256
File: /mnt/ramdisk/book/users01.dbf (4)
Block: 131 Offsets: 0 to 255 Dba:0x01000083
-----------------------------------------------------------------------------------------------------------
06a20000 83000001 e40e0e00 00000204 5d700000 01000c00 42540100 e40e0e00 l ................]p......BT......
0000e81f 02003200 80000001 00000000 00000000 00000000 00000000 00000000 l ......2.........................
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 l ................................
00000000 00000000 ffff0e00 981f8a1f 8a1f0000 0000c819 73191e19 c5186c18 l ........................s.....l.
1018b417 5817fc16 a0164416 e8158c15 3215d814 7c142014 c6136c13 1913c612 l ....X.....D.....2...|. ...l.....
6b121012 ba116411 0811ac10 58100410 a80f4c0f f50e9d0e 430ee90d 970d450d l k.....d.....X.....L.....C.....E.
f10c9d0c 450ced0b 970b410b f50aa90a 4d0af109 a1095109 0109b108 5d080908 l ....E.....A.....M.....Q.....]...
bf077507 1f07c906 70061706 bb055f05 0b05b704 5c040104 b812c812 d812e812 l ..u.....p....._.....\...........
<32 bytes per line>
--//如果输入如下:
BBED> dump /v offset 0 count 256 filename '/mnt/ramdisk/book/users01.dbf' block 135
File: /mnt/ramdisk/book/users01.dbf (4)
Block: 135 Offsets: 0 to 255 Dba:0x01000087
-----------------------------------------------------------------------------------------------------------
06a20000 87000001 70786917 03000204 56a50000 01001600 42540100 70786917 l ........pxi.....V.......BT..pxi.
0300e81f 021f3200 80000001 09000200 64030000 b067c100 9a002e00 00800000 l ......2.........d....g..........
f00e0e00 00000000 00000000 00000000 00000000 00000000 00000000 00000000 l ................................
00000000 00010400 ffff1a00 261f221f 221f0000 04007e1f 261f541f 3c1f8918 l ............&.".".....~.&.T.<...
2d18d117 7e172b17 d8168516 3216df15 8b153715 db147f14 2314c713 74132113 l -...~.+.....2.....7.....#...t.!.
c5126912 0d12b111 5511f910 9d104110 e50f890f 350fe10e 850e290e ce0d730d l ..i.....U.....A.....5.....)...s.
170dbb0c 640c0d0c ba0b670b 140bc10a 6e0a1b0a c8097509 1a09bf08 6b081608 l ....d.....g.....n.....u.....k...
bb076007 0e07bc06 6a061806 c5057205 1605ba04 65041004 02000400 12000000 l ..`.....j.....r.....e...........
<32 bytes per line>
BBED> dump /v offset 8000 count 256 filename '/mnt/ramdisk/book/users01.dbf' block 135
File: /mnt/ramdisk/book/users01.dbf (4)
Block: 135 Offsets: 0 to 255 Dba:0x01000087
-----------------------------------------------------------------------------------------------------------
06a20000 87000001 70786917 03000204 56a50000 01001600 42540100 70786917 l ........pxi.....V.......BT..pxi.
0300e81f 021f3200 80000001 09000200 64030000 b067c100 9a002e00 00800000 l ......2.........d....g..........
f00e0e00 00000000 00000000 00000000 00000000 00000000 00000000 00000000 l ................................
00000000 00010400 ffff1a00 261f221f 221f0000 04007e1f 261f541f 3c1f8918 l ............&.".".....~.&.T.<...
2d18d117 7e172b17 d8168516 3216df15 8b153715 db147f14 2314c713 74132113 l -...~.+.....2.....7.....#...t.!.
c5126912 0d12b111 5511f910 9d104110 e50f890f 350fe10e 850e290e ce0d730d l ..i.....U.....A.....5.....)...s.
170dbb0c 640c0d0c ba0b670b 140bc10a 6e0a1b0a c8097509 1a09bf08 6b081608 l ....d.....g.....n.....u.....k...
bb076007 0e07bc06 6a061806 c5057205 1605ba04 65041004 02000400 12000000 l ..`.....j.....r.....e...........
<32 bytes per line>
--//第一次执行是正确的,而第2次就不对了(offset还是0).
--//如果按照dump帮助的顺序输入参数,就不会出问题了.
BBED> help dump
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
BBED> dump /v filename '/mnt/ramdisk/book/users01.dbf' block 135 offset 0 count 256
File: /mnt/ramdisk/book/users01.dbf (4)
Block: 135 Offsets: 0 to 255 Dba:0x01000087
-----------------------------------------------------------------------------------------------------------
06a20000 87000001 70786917 03000204 56a50000 01001600 42540100 70786917 l ........pxi.....V.......BT..pxi.
0300e81f 021f3200 80000001 09000200 64030000 b067c100 9a002e00 00800000 l ......2.........d....g..........
f00e0e00 00000000 00000000 00000000 00000000 00000000 00000000 00000000 l ................................
00000000 00010400 ffff1a00 261f221f 221f0000 04007e1f 261f541f 3c1f8918 l ............&.".".....~.&.T.<...
2d18d117 7e172b17 d8168516 3216df15 8b153715 db147f14 2314c713 74132113 l -...~.+.....2.....7.....#...t.!.
c5126912 0d12b111 5511f910 9d104110 e50f890f 350fe10e 850e290e ce0d730d l ..i.....U.....A.....5.....)...s.
170dbb0c 640c0d0c ba0b670b 140bc10a 6e0a1b0a c8097509 1a09bf08 6b081608 l ....d.....g.....n.....u.....k...
bb076007 0e07bc06 6a061806 c5057205 1605ba04 65041004 02000400 12000000 l ..`.....j.....r.....e...........
<32 bytes per line>
BBED> dump /v filename '/mnt/ramdisk/book/users01.dbf' block 135 offset 8000 count 256
File: /mnt/ramdisk/book/users01.dbf (4)
Block: 135 Offsets: 8000 to 8191 Dba:0x01000087
-----------------------------------------------------------------------------------------------------------
ff0180ff 018004c3 07382402 c1022c00 1204c306 2423ff01 80196a61 76612f6e l .........8$...,.....$#....java/n
65742f55 524c436c 6173734c 6f616465 72243402 c102ff02 c11e0778 7108180c l et/URLClassLoader$4........xq...
2e120778 7108180c 2e122c00 0302c115 08524553 45415243 48064441 4c4c4153 l ...xq.....,......RESEARCH.DALLAS
2c000302 c1290a4f 50455241 54494f4e 5306424f 53544f4e 2c000302 c11f0553 l ,....).OPERATIONS.BOSTON,......S
414c4553 07434849 4341474f 3c020302 c1150852 45534541 52434806 44414c4c l ALES.CHICAGO<......RESEARCH.DALL
41532c00 0302c10b 0a414343 4f554e54 494e4708 4e455720 594f524b 02067078 l AS,......ACCOUNTING.NEW YORK..px
<32 bytes per line>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2147691/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/267265/viewspace-2147691/