然后,我们从中随便挑一个叶子节点,对其进行转储。假设就选row#0行所指向的叶子节点,根据dba的值:
25226402可以知道,文件号为6,数据块号为60578。将其转储以后,其内容如下所示,我只显示与分支节点不同的部分。
----- begin tree dump
branch: 0x103151b 16979227 (0: nrow: 7, level: 2)
branch: 0x1031735 16979765 (-1: nrow: 419, level: 1)
leaf: 0x103151c 16979228 (-1: nrow: 359 rrow: 359)
leaf: 0x103151d 16979229 (0: nrow: 359 rrow: 359)
leaf: 0x103151e 16979230 (1: nrow: 359 rrow: 359)
leaf: 0x103151f 16979231 (2: nrow: 359 rrow: 359)
leaf: 0x1031520 16979232 (3: nrow: 359 rrow: 359)
leaf: 0x1031521 16979233 (4: nrow: 359 rrow: 359)
leaf: 0x1031522 16979234 (5: nrow: 359 rrow: 359)
leaf: 0x1031523 16979235 (6: nrow: 359 rrow: 359)
leaf: 0x1031524 16979236 (7: nrow: 359 rrow: 359)
leaf: 0x1031525 16979237 (8: nrow: 359 rrow: 359)
16979228
select value from v$diag_info where name='Default Trace File';
SQL> select dbms_utility.data_block_address_file(16979228),
dbms_utility.data_block_address_block(16979228)
from dual; 2 3
DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE(16979228) DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK(16979228)
---------------------------------------------- -----------------------------------------------
4 202012
alter system dump datafile 4 block 202012;
Leaf block dump
===============
header address 139655992351332=0x7f0431d09a64
kdxcolev 0
KDXCOLEV Flags = - - -
kdxcolok 0
kdxcoopc 0x80: opcode=0: iot flags=--- is converted=Y
kdxconco 2
kdxcosdc 0
kdxconro 359
kdxcofbo 754=0x2f2
kdxcofeo 1570=0x622
kdxcoavs 816
kdxlespl 0
kdxlende 0
kdxlenxt 16979229=0x103151d
kdxleprv 0=0x0
kdxledsz 0
kdxlebksz 8032
row#0[8014] flag: ------, lock: 0, len=18
col 0; len 8; (8): 35 30 30 30 30 20 20 20
col 1; len 6; (6): 01 03 67 b9 00 07
row#1[7996] flag: ------, lock: 0, len=18
col 0; len 8; (8): 35 30 30 30 30 20 20 20
col 1; len 6; (6): 01 03 7d 76 00 61
row#2[7978] flag: ------, lock: 0, len=18
col 0; len 8; (8): 35 30 30 30 30 20 20 20
col 1; len 6; (6): 01 03 7d 7f 00 5e
row#3[7960] flag: ------, lock: 0, len=18
col 0; len 8; (8): 35 30 30 30 30 20 20 20
col 1; len 6; (6): 01 03 7e 42 00 64
row#4[7942] flag: ------, lock: 0, len=18
col 0; len 8; (8): 35 30 30 30 30 20 20 20
col 1; len 6; (6): 01 03 7f 5e 00 7b
row#0[8014] flag: ------, lock: 0, len=18
col 0; len 8; (8): 35 30 30 30 30 20 20 20 ---50000
col 1; len 6; (6): 01 03 67 b9 00 07 ---
DECLARE
n VARCHAR2(2000);
BEGIN
DBMS_STATS.convert_raw_value('35', n);
DBMS_OUTPUT.put_line(n);
DBMS_STATS.convert_raw_value('30', n);
DBMS_OUTPUT.put_line(n);
DBMS_STATS.convert_raw_value('30', n);
DBMS_OUTPUT.put_line(n);
DBMS_STATS.convert_raw_value('30', n);
DBMS_OUTPUT.put_line(n);
DBMS_STATS.convert_raw_value('30', n);
DBMS_OUTPUT.put_line(n);
DBMS_STATS.convert_raw_value('20', n);
DBMS_OUTPUT.put_line(n);
DBMS_STATS.convert_raw_value('20', n);
DBMS_OUTPUT.put_line(n);
DBMS_STATS.convert_raw_value('20', n);
DBMS_OUTPUT.put_line(n);
END;
转换后为50000
col 1是rowid,01 00 0c 8f 00 00是rowid的一部分值,也是16进制的.,先要转换成2进制的,
再通过各个位数代表的意义计算文件号,块号和和行号。
01 00 0c 8f 00 00 先转换为2进制:(注意前面先补足0)
10000000000001100100011110000000000000000
col 1; len 6; (6):
01 03 67 b9 00 07 ---
00000001 00000011 01100111 10111001 00000000 00000111
00000001 00000011 01100111 10111001 00000000 00000111
然后串起来之后前10位 0000000100 表示文件号,=4 2进制转换为10进制表示4
然后是接下来的22位 000000 00000000 00001100表示块号
0000110110011110111001 2进制转换为10进制为223161
最后面的的16位表示行号
0000000000000111 2进制转换为10进制为7,行号为7
col 0; len 8; (8): 35 30 30 30 30 20 20 20
col 1; len 6; (6): 01 03 7f 5e 00 7b
00000001 000000011 01111111 01011110 00000000 01111011
0000000100 --4
00000110111111101011110 -- 229214
0000000001111011 --123
select owner, segment_name, segment_type
from dba_extents
where file_id = 4
and 223161 between block_id and block_id + blocks - 1;
SQL> select owner, segment_name, segment_type
2 from dba_extents
3 where file_id = 4
4 and 223161 between block_id and block_id + blocks - 1;
OWNER SEGMENT_NAME SEGMENT_TYPE
------------------------------ -------------------------------------------------------------------------------- ------------------
TEST TEST TABLE
select owner, segment_name, segment_type
from dba_extents
where file_id = 4
and 229214 between block_id and block_id + blocks - 1;
SQL> select owner, segment_name, segment_type
2 from dba_extents
3 where file_id = 4
4 and 229214 between block_id and block_id + blocks - 1;
OWNER SEGMENT_NAME SEGMENT_TYPE
------------------------------ -------------------------------------------------------------------------------- ------------------
TEST TEST TABLE
1 AAAVvMAAEAAA2e5AAH 50000 javax/swing/text/ViewFactory
2 AAAVvMAAEAAA312ABh 50000 javax/swing/text/ViewFactory
3 AAAVvMAAEAAA31/ABe 50000 javax/swing/text/ViewFactory
4 AAAVvMAAEAAA35CABk 50000 javax/swing/text/ViewFactory
5 AAAVvMAAEAAA39eAB7 50000 javax/swing/text/ViewFactory
6 AAAVvMAAEAAA3/kABB 50000 javax/swing/text/ViewFactory
7 AAAVvMAAEAAA4BWAAh 50000 javax/swing/text/ViewFactory
8 AAAVvMAAEAAA4EGABo 50000 javax/swing/text/ViewFactory
9 AAAVvMAAEAAA4HEAAc 50000 javax/swing/text/ViewFactory
10 AAAVvMAAEAAA4JKAA9 50000 javax/swing/text/ViewFactory
11 AAAVvMAAEAAA4KCAAa 50000 javax/swing/text/ViewFactory
12 AAAVvMAAEAAA4OfAA3 50000 javax/swing/text/ViewFactory
13 AAAVvMAAEAAA4R9ACW 50000 javax/swing/text/ViewFactory
14 AAAVvMAAEAAA4UCAAV 50000 javax/swing/text/ViewFactory
15 AAAVvMAAEAAA4ULAAa 50000 javax/swing/text/ViewFactory
16 AAAVvMAAEAAA4Z3AAE 50000 javax/swing/text/ViewFactory
17 AAAVvMAAEAAA4c4AB5 50000 javax/swing/text/ViewFactory
18 AAAVvMAAEAAA4eDAAc 50000 javax/swing/text/ViewFactory
19 AAAVvMAAEAAA4emADI 50000 javax/swing/text/ViewFactory
20 AAAVvMAAEAAA4jAAAb 50000 javax/swing/text/ViewFactory
21 AAAVvMAAEAAA4m2AA1 50000 javax/swing/text/ViewFactory
22 AAAVvMAAEAAA4pdABT 50000 javax/swing/text/ViewFactory
23 AAAVvMAAEAAA4p2AAb 50000 javax/swing/text/ViewFactory
24 AAAVvMAAEAAA4uoAAV 50000 javax/swing/text/ViewFactory
25 AAAVvMAAEAAA4y4ABv 50000 javax/swing/text/ViewFactory
26 AAAVvMAAEAAA4zBABC 50000 javax/swing/text/ViewFactory
27 AAAVvMAAEAAA40sACw 50000 javax/swing/text/ViewFactory
28 AAAVvMAAEAAA44MACT 50000 javax/swing/text/ViewFactory
29 AAAVvMAAEAAA47FAAl 50000 javax/swing/text/ViewFactory
30 AAAVvMAAEAAA49BABX 50000 javax/swing/text/ViewFactory
31 AAAVvMAAEAAA490ACB 50000 javax/swing/text/ViewFactory
32 AAAVvMAAEAAA5DYAA6 50000 javax/swing/text/ViewFactory
找个rowid 测试下:
SQL> select rowid,
a.goodid,
dbms_rowid.rowid_relative_fno('AAAVvMAAEAAA2e5AAH') fno,
dbms_rowid.rowid_block_number('AAAVvMAAEAAA2e5AAH') bkno,
dbms_rowid.rowid_row_number('AAAVvMAAEAAA2e5AAH') rno
from test a
where a.goodid= 50000; 2 3 4 5 6 7
ROWID GOODID FNO BKNO RNO
------------------ -------- ---------- ---------- ----------
AAAVvMAAEAAA2e5AAH 50000 4 223161 7
AAAVvMAAEAAA312ABh 50000 4 223161 7
AAAVvMAAEAAA31/ABe 50000 4 223161 7
AAAVvMAAEAAA35CABk 50000 4 223161 7
AAAVvMAAEAAA39eAB7 50000 4 223161 7
AAAVvMAAEAAA3/kABB 50000 4 223161 7
AAAVvMAAEAAA4BWAAh 50000 4 223161 7
AAAVvMAAEAAA4EGABo 50000 4 223161 7
AAAVvMAAEAAA4HEAAc 50000 4 223161 7
AAAVvMAAEAAA4JKAA9 50000 4 223161 7
AAAVvMAAEAAA4KCAAa 50000 4 223161 7
AAAVvMAAEAAA4OfAA3 50000 4 223161 7
AAAVvMAAEAAA4R9ACW 50000 4 223161 7
AAAVvMAAEAAA4UCAAV 50000 4 223161 7
AAAVvMAAEAAA4ULAAa 50000 4 223161 7
AAAVvMAAEAAA4Z3AAE 50000 4 223161 7
AAAVvMAAEAAA4c4AB5 50000 4 223161 7
AAAVvMAAEAAA4eDAAc 50000 4 223161 7
AAAVvMAAEAAA4emADI 50000 4 223161 7
AAAVvMAAEAAA4jAAAb 50000 4 223161 7
AAAVvMAAEAAA4m2AA1 50000 4 223161 7
AAAVvMAAEAAA4pdABT 50000 4 223161 7
AAAVvMAAEAAA4p2AAb 50000 4 223161 7
AAAVvMAAEAAA4uoAAV 50000 4 223161 7
AAAVvMAAEAAA4y4ABv 50000 4 223161 7
AAAVvMAAEAAA4zBABC 50000 4 223161 7
AAAVvMAAEAAA40sACw 50000 4 223161 7
AAAVvMAAEAAA44MACT 50000 4 223161 7
AAAVvMAAEAAA47FAAl 50000 4 223161 7
AAAVvMAAEAAA49BABX 50000 4 223161 7
AAAVvMAAEAAA490ACB 50000 4 223161 7
AAAVvMAAEAAA5DYAA6 50000 4 223161 7
32 rows selected.