码迷,mamicode.com
首页 > 其他好文 > 详细

data block address

时间:2016-06-24 15:08:40      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

这里讨论的不是数据库管理员DBA,而是数据块地址DBA:Data Block Address!
A Data Block Address (DBA) is the address of an Oracle data block for access purposes.
----源自《Oracle内核技术揭秘》的探索
DBA的结构:8以后,DBA中,前10个二进制位是文件号,后面的就是块号了。
DBA的转换:dump出来文件之后,有的DBA后面有转换后的结果,比如:
rdba: 0x010001c8 (4/456);有的DBA却没有转换后的结果,比如记录高水位的DBA:
 HWM Flag: HWM Set
      Highwater::  0x010001d0  ext#: 0      blk#: 8      ext size: 8     
以例子中的DBA为例,转换:

技术分享

一个DBA转换的例子:转自:http://www.orafaq.com/wiki/Data_block_address
Find the DBA for a given rowStart by getting the file and block number of the row. Example:
SQL> SELECT
  2    dbms_rowid.rowid_relative_fno(rowid) REL_FNO,
  3    dbms_rowid.rowid_block_number(rowid) BLOCKNO,
  4    empno, ename
  5  FROM emp WHERE empno = 7369;
   REL_FNO    BLOCKNO      EMPNO ENAME
---------- ---------- ---------- ----------
         4         20       7369 SMITH

Now, convert the file and block numbers to a DBA address:
SQL> variable dba varchar2(30)
SQL> exec :dba := dbms_utility.make_data_block_address(4, 20);
PL/SQL procedure successfully completed.
SQL> print dba
DBA
--------------------------------
16777236

Convert a DBA back to file and block numbersExample:
SQL> SELECT dbms_utility.data_block_address_block(16777236) "BLOCK",
  2         dbms_utility.data_block_address_file(16777236) "FILE"
  3    FROM dual;
     BLOCK       FILE
---------- ----------
        20          4

不过,使用dbms_utility包搞出来的DBA与dump出来的DBA不相同,dump出来的DBA,可以使用转换二进制的方<span><span>式计算出来(上面给出了例子),但是dbms_utility计算出来的DBA,使用转换二进制的方式,算出来的明显不正确。</span></span>


data block address

标签:

原文地址:http://blog.csdn.net/ghostliming/article/details/51746343

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!