dba rdba转换

1.      Dba (data block address),a DBA is the address of an oracle data block for access purposes.

2.      利用已知數據查找dba

SQL>select dbms_rowid.rowid_relative_fno(rowid) rel_no,

Dbms_rowid.rowid_block_number(rowid) block_no ,x from lerry.t1;

REL_NO   BLOCK_NO         X

--------------------------------------------------------------------------------

   4        174       my name is lerry

4        174       testy is befaulty

3.      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,174);

PL/SQL procedure successfully completed.

SQL> print dba;

DBA

--------------------------------------------------------------------------------

16777390

4.      Convert a dba address to the file and block numbers

SQL>  select dbms_utility.data_block_address_block(16777390) "bl0ck",

  dbms_utility.data_block_address_file(16777390) "file" from dual;

  blick       file

----------    ----------

 174          4

 

select dbms_utility.data_block_address_block(&dba) "bl0ck",

  dbms_utility.data_block_address_file(&dba) "file" from dual;

 

SQL> select to_number('10000ae','xxxxxxx') from dual;

TO_NUMBER('10000AE','XXXXXXX')

------------------------------

     16777390

5.      RDBA (Tablespace relative database block address)

RDBA 是相對數據塊地址,是數據所在的地址rdba可就是rowid rfile#+block#16777390

6.      Alter sytem dump file 4 block 174;

查看dump文件,

 

SQL> select to_number('10000ae','xxxxxxx') from dual;

 

TO_NUMBER('10000AE','XXXXXXX')

------------------------------

  16777390

SQL> select dbms_rowid.rowid_relative_fno(rowid) rel_no,

   Dbms_rowid.rowid_block_number(rowid) block_no ,

  dbms_rowid.rowid_row_number(rowid) rowno from lerry.t1;

 REL_NO BLOCK_NO  ROWNO

----------   ---------     ----------

   4        174          0

   4        174          1

可以通过dbms_rowid这个包来转换我们的rowid成不同组成部分:

    dbms_rowid.rowid_object(rowid)---&gt 32bit object#
    dbms_rowid.rowid_relative_fno(rowid)---&gt 10bit rfile#
    dbms_rowid.rowid_block_number(rowid)---&gt 22bit block#
    dbms_rowid.rowid_row_number(rowid)---&gt 16bit row#


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.      Dba (data block address),a DBA is the address of an oracle data block for access purposes.

2.      利用已知數據查找dba

SQL>select dbms_rowid.rowid_relative_fno(rowid) rel_no,

Dbms_rowid.rowid_block_number(rowid) block_no ,x from lerry.t1;

REL_NO   BLOCK_NO         X

--------------------------------------------------------------------------------

   4        174       my name is lerry

4        174       testy is befaulty

3.      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,174);

PL/SQL procedure successfully completed.

SQL> print dba;

DBA

--------------------------------------------------------------------------------

16777390

4.      Convert a dba address to the file and block numbers

SQL>  select dbms_utility.data_block_address_block(16777390) "bl0ck",

  dbms_utility.data_block_address_file(16777390) "file" from dual;

  blick       file

----------    ----------

 174          4

 

select dbms_utility.data_block_address_block(&dba) "bl0ck",

  dbms_utility.data_block_address_file(&dba) "file" from dual;

 

SQL> select to_number('10000ae','xxxxxxx') from dual;

TO_NUMBER('10000AE','XXXXXXX')

------------------------------

     16777390

5.      RDBA (Tablespace relative database block address)

RDBA 是相對數據塊地址,是數據所在的地址rdba可就是rowid rfile#+block#16777390

6.      Alter sytem dump file 4 block 174;

查看dump文件,

 

SQL> select to_number('10000ae','xxxxxxx') from dual;

 

TO_NUMBER('10000AE','XXXXXXX')

------------------------------

  16777390

SQL> select dbms_rowid.rowid_relative_fno(rowid) rel_no,

   Dbms_rowid.rowid_block_number(rowid) block_no ,

  dbms_rowid.rowid_row_number(rowid) rowno from lerry.t1;

 REL_NO BLOCK_NO  ROWNO

----------   ---------     ----------

   4        174          0

   4        174          1

可以通过dbms_rowid这个包来转换我们的rowid成不同组成部分:

    dbms_rowid.rowid_object(rowid)---&gt 32bit object#
    dbms_rowid.rowid_relative_fno(rowid)---&gt 10bit rfile#
    dbms_rowid.rowid_block_number(rowid)---&gt 22bit block#
    dbms_rowid.rowid_row_number(rowid)---&gt 16bit row#


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24849178/viewspace-714124/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24849178/viewspace-714124/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值