ITPub博客

首页 > Linux操作系统 > Linux操作系统 > dba rdba转换

dba rdba转换

原创 Linux操作系统 作者:g644516804 时间:2011-12-29 10:43:13 0 删除 编辑

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)---> 32bit object#
    dbms_rowid.rowid_relative_fno(rowid)---> 10bit rfile#
    dbms_rowid.rowid_block_number(rowid)---> 22bit block#
    dbms_rowid.rowid_row_number(rowid)---> 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)---> 32bit object#
    dbms_rowid.rowid_relative_fno(rowid)---> 10bit rfile#
    dbms_rowid.rowid_block_number(rowid)---> 22bit block#
    dbms_rowid.rowid_row_number(rowid)---> 16bit row#


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

请登录后发表评论 登录
全部评论

注册时间:2011-03-04

  • 博文量
    104
  • 访问量
    231611