重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

数据块内部偏移量的基本计算方法

BASE的计算方法为:
对于ASSM:76+(itc-1) * 24= 52 + itc * 24
对于MSSM:68+(itc-1) * 24= 44 + itc * 24


在陵川等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站制作、成都网站设计 网站设计制作按需网站开发,公司网站建设,企业网站建设,高端网站设计,全网整合营销推广,外贸网站制作,陵川网站建设费用合理。

点击(此处)折叠或打开

  1. gyj@ZMDB> select * from v$type_size where component in ('KCB','KTB');

  2. COMPONEN TYPE DESCRIPTION TYPE_SIZE

  3. -------- -------- -------------------------------- ----------

  4. KCB KCBH BLOCK COMMON HEADER 20

  5. KTB KTBIT TRANSACTION VARIABLE HEADER 24

  6. KTB KTBBH TRANSACTION FIXED HEADER 48

  7. KTB KTBBH_BS TRANSACTION BLOCK BITMAP SEGMENT 8


1、我们先对ASSM做测试

点击(此处)折叠或打开

  1. gyj@ZMDB> select * from v$version;

  2. BANNER

  3. --------------------------------------------------------------------------------

  4. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

  5. gyj@ZMDB> create tablespace assm datafile '/u01/app/oracle/oradata/zmdb/assm01.dbf' size 50M;

  6. Tablespace created.

  7. gyj@ZMDB> create table gyj_t5(id int,name varchar2(100)) tablespace assm;

  8. Table created.

  9. gyj@ZMDB> insert into gyj_t5 values(1,'AAAAA');

  10. 1 row created.

  11. gyj@ZMDB> insert into gyj_t5 values(2,'BBBBB');

  12. 1 row created.

  13. gyj@ZMDB> insert into gyj_t5 values(3,'CCCCC');

  14. 1 row created.

  15. gyj@ZMDB> COMMIT;

  16. Commit complete.

  17. gyj@ZMDB> alter system flush buffer_cache;

  18. System altered.

  19. gyj@ZMDB> select dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block#,id,name from gyj_t5;

  20.      FILE# BLOCK# ID NAME

  21. ---------- ---------- ---------- ----------

  22.         10 135 1 AAAAA

  23.         10 135 2 BBBBB

  24.         10 135 3 CCCCC

  25. BBED> set file 10 block 135

  26.         FILE# 10

  27.         BLOCK# 135

  28. BBED> p kdbr[0]

  29. sb2 kdbr[0] @118 8076

  30. BBED> p *kdbr[0]

  31. rowdata[24]

  32. -----------

  33. ub1 rowdata[24] @8176 0x2c

  34. BBED> x /rnc

  35. rowdata[24] @8176 

  36. -----------

  37. flag@8176: 0x2c (KDRHFL, KDRHFF, KDRHFH)

  38. lock@8177: 0x01

  39. cols@8178: 2

  40. col 0[2] @8179: 1 

  41. col 1[5] @8182: AAAAA

  42. BBED> p ktbbhict

  43. sb2 ktbbhict @36 2

  44. 8176-8076=76+(itc-1) * 24= 76+(2-1)* 24=100


2、我们对MSSM做测试

点击(此处)折叠或打开

  1. gyj@ZMDB> create tablespace mssm datafile '/u01/app/oracle/oradata/zmdb/mssm01.dbf' size 50M segment space management manual;

  2. Tablespace created.

  3. gyj@ZMDB> create table gyj_mssm(id int,name varchar2(100)) tablespace mssm;

  4. Table created.

  5. gyj@ZMDB> insert into gyj_mssm values(4,'DDDDD');

  6. 1 row created.

  7. gyj@ZMDB> insert into gyj_mssm values(5,'EEEEE');

  8. 1 row created.

  9. gyj@ZMDB> insert into gyj_mssm values(6,'FFFFF');

  10. 1 row created.

  11. gyj@ZMDB> commit;

  12. Commit complete.

  13. gyj@ZMDB> col name for a20

  14. gyj@ZMDB> select dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block#,id,name from gyj_mssm;

  15.      FILE# BLOCK# ID NAME

  16. ---------- ---------- ---------- --------------------

  17.         11 129 4 DDDDD

  18.         11 129 5 EEEEE

  19.         11 129 6 FFFFF

  20. BBED> set file 11 block 129

  21.         FILE# 11

  22.         BLOCK# 129

  23. BBED> p kdbr[0]

  24. sb2 kdbr[0] @110 8084

  25. BBED> p *kdbr[0]

  26. rowdata[24]

  27. -----------

  28. ub1 rowdata[24] @8176 0x2c

  29. BBED> x /rnc

  30. rowdata[24] @8176 

  31. -----------

  32. flag@8176: 0x2c (KDRHFL, KDRHFF, KDRHFH)

  33. lock@8177: 0x01

  34. cols@8178: 2

  35. col 0[2] @8179: 4 

  36. col 1[5] @8182: DDDDD

  37. BBED> p ktbbhict

  38. sb2 ktbbhict @36 2

  39. 8176-8084=68+(itc-1) * 24=68+(2-1)*24=92


3、为什么ASSM要比MSSM多了8个字节

点击(此处)折叠或打开

  1. ************MSSM

  2. BBED> set file 11 block 129

  3.         FILE# 11

  4.         BLOCK# 129

  5. BBED> map /v

  6.  File: /u01/app/oracle/oradata/zmdb/mssm01.dbf (11)

  7.  Block: 129 Dba:0x02c00081

  8. ------------------------------------------------------------

  9.  KTB Data Block (Table/Cluster)

  10.  struct kcbh, 20 bytes @0 

  11.     ub1 type_kcbh @0 

  12.     ub1 frmt_kcbh @1 

  13.     ub1 spare1_kcbh @2 

  14.     ub1 spare2_kcbh @3 

  15.     ub4 rdba_kcbh @4 

  16.     ub4 bas_kcbh @8 

  17.     ub2 wrp_kcbh @12 

  18.     ub1 seq_kcbh @14 

  19.     ub1 flg_kcbh @15 

  20.     ub2 chkval_kcbh @16 

  21.     ub2 spare3_kcbh @18 

  22.  struct ktbbh, 72 bytes @20 

  23.     ub1 ktbbhtyp @20 

  24.     union ktbbhsid, 4 bytes @24 

  25.     struct ktbbhcsc, 8 bytes @28 

  26.     sb2 ktbbhict @36 

  27.     ub1 ktbbhflg @38 

  28.     ub1 ktbbhfsl @39 

  29.     ub4 ktbbhfnx @40 

  30.     struct ktbbhitl[2], 48 bytes @44 

  31.  struct kdbh, 14 bytes @92 

  32.     ub1 kdbhflag @92 

  33.     sb1 kdbhntab @93 

  34.     sb2 kdbhnrow @94 

  35.     sb2 kdbhfrre @96 

  36.     sb2 kdbhfsbo @98 

  37.     sb2 kdbhfseo @100 

  38.     sb2 kdbhavsp @102 

  39.     sb2 kdbhtosp @104 

  40.  struct kdbt[1], 4 bytes @106 

  41.     sb2 kdbtoffs @106 

  42.     sb2 kdbtnrow @108 

  43.  sb2 kdbr[3] @110 

  44.  ub1 freespace[8036] @116 

  45.  ub1 rowdata[36] @8152 

  46.  ub4 tailchk @8188

  47. *****************ASSM

  48. BBED> set file 10 block 135

  49.         FILE# 10

  50.         BLOCK# 135

  51. File: /u01/app/oracle/oradata/zmdb/assm01.dbf (10)

  52.  Block: 141 Dba:0x0280008d

  53. ------------------------------------------------------------

  54.  KTB Data Block (Table/Cluster)

  55.  struct kcbh, 20 bytes @0 

  56.     ub1 type_kcbh @0 

  57.     ub1 frmt_kcbh @1 

  58.     ub1 spare1_kcbh @2 

  59.     ub1 spare2_kcbh @3 

  60.     ub4 rdba_kcbh @4 

  61.     ub4 bas_kcbh @8 

  62.     ub2 wrp_kcbh @12 

  63.     ub1 seq_kcbh @14 

  64.     ub1 flg_kcbh @15 

  65.     ub2 chkval_kcbh @16 

  66.     ub2 spare3_kcbh @18 

  67.  struct ktbbh, 72 bytes @20 

  68.     ub1 ktbbhtyp @20 

  69.     union ktbbhsid, 4 bytes @24 

  70.     struct ktbbhcsc, 8 bytes @28 

  71.     sb2 ktbbhict @36 

  72.     ub1 ktbbhflg @38 

  73.     ub1 ktbbhfsl @39 

  74.     ub4 ktbbhfnx @40 

  75.     struct ktbbhitl[2], 48 bytes @44 

  76.  struct kdbh, 14 bytes @100 

  77.     ub1 kdbhflag @100 

  78.     sb1 kdbhntab @101 

  79.     sb2 kdbhnrow @102 

  80.     sb2 kdbhfrre @104 

  81.     sb2 kdbhfsbo @106 

  82.     sb2 kdbhfseo @108 

  83.     sb2 kdbhavsp @110 

  84.     sb2 kdbhtosp @112 

  85.  struct kdbt[1], 4 bytes @114 

  86.     sb2 kdbtoffs @114 

  87.     sb2 kdbtnrow @116 

  88.  sb2 kdbr[3] @118 

  89.  ub1 freespace[8028] @124 

  90.  ub1 rowdata[36] @8152 

  91.  ub4 tailchk @8188


对比
-----MSSM
   struct ktbbhitl[2], 48 bytes            @44     

 struct kdbh, 14 bytes                     @92 

---ASSM   
   struct ktbbhitl[2], 48 bytes            @44     

 struct kdbh, 14 bytes                      @100 
 
@92---->@100  kdbh偏移量发生了变化,增加了8个byte。


本文标题:数据块内部偏移量的基本计算方法
当前路径:http://cqcxhl.cn/article/poidop.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP