Data block address

From Oracle FAQ
Jump to: navigation, search

A Data Block Address (DBA) is the address of an Oracle data block for access purposes.

Find the DBA for a given row[edit]

Start 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 numbers[edit]

Example:

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

Also see[edit]