Data Block Address (DBA)各种形式间的转换


通过表里的数据定位文件号块号, 通过dba地址定位所在的文件号块号


1. 定位 A表 a=10这一行的数据在哪个file,哪个block

SQL> select dbms_rowid.rowid_relative_fno(rowid)file#,dbms_rowid.rowid_block_number(rowid)blk# from t1 where a=10;

 FILE# BLK#
---------- ----------
 6     135
 6     135
 
2.获取文件dba地址

SQL> variable dba varchar2(30)
SQL> exec :dba := dbms_utility.make_data_block_address(6, 135);
PL/SQL procedure successfully completed.
SQL> print dba
DBA
----------------
25165959 

3.将dba转换成 file号block号

SQL> SELECT dbms_utility.data_block_address_file(25165959) "FILE",
     dbms_utility.data_block_address_block(25165959) "BLOCK" FROM dual;

FILE BLOCK
----------
 6    135
 

4. 这里1800087 是 16进制的转换成10进制是 25165959 

SQL> select dbms_utility.data_block_address_file(TO_NUMBER('1800087', 'XXXXXXXX')) file_id,
dbms_utility.data_block_address_block(TO_NUMBER('1800087', 'XXXXXXXX')) block_id from dual;

FILE_ID BLOCK_ID
---------- ----------
6           135 
 


你可能感兴趣的:(dba,Data,block,Address)