data block address

这里讨论的不是数据库管理员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为例,转换:

data block address_第1张图片

一个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)