标签:rowid rowid转换rdba get_rowid getbfno rdba转换file#block#
--数据的存储属性rowid
--数据文件file#
--数据库对象obj#
--数据块号:block_no#
--表中行号
--物理rowid和逻辑rowid
--索引使用逻辑rowid
--其他类型使用物理rowid
--rowid伪列
select rowid,id,time from rangetable;
--因为rowid唯一标示一条记录,所以索引存储rowid值;通过索引中,找到rowid;
--新的base64编码。32bit obj#,10bit rfile#,22bit block#,16bit row#
--因此每个表空间最大1022个文件,每个数据文件最大4M=4000个block
--每个block中的行数最大65536行;
--通过dbms_rowid来转换rowid的信息
create or replace function get_rowid(l_rowid in varchar2)
return varchar2
is
ls_my_rowid varchar2(200);
rowid_type number;
object_number number;
relative_fno number;
block_number number;
row_number number;
begin
dbms_rowid.rowid_info(l_rowid,rowid_type,object_number,relative_fno,block_number,row_number);
ls_my_rowid:=‘Object# is :‘
||to_char(object_number)||chr(10)||
‘relative_fno is :‘
||to_char(relative_fno)||chr(10)||
‘block_number is :‘
||to_char(block_number)||chr(10)||
‘row number is :‘
||to_char(row_number)||chr(10);
return ls_my_rowid;
end;
select rowid,a.* from dept a;
select get_rowid(‘AAAMfNAAEAAAAAQAAA‘) row_id from dual;
--转储system的表空间
alter session set events ‘immediate trace name FILE_HDRS level 10‘
--查看udummp文件dba地址
写了一个简单的函数,用来从RDBA中转换file#和block#出来:
CREATE OR REPLACE FUNCTION getbfno (p_dba IN VARCHAR2)
RETURN VARCHAR2
IS
l_str VARCHAR2 (255) DEFAULT NULL;
l_fno VARCHAR2 (15);
l_bno VARCHAR2 (15);
BEGIN
l_fno :=
DBMS_UTILITY.data_block_address_file (TO_NUMBER(LTRIM (p_dba, ‘0x‘), ‘xxxxxxxx‘));
l_bno :=
DBMS_UTILITY.data_block_address_block (TO_NUMBER (LTRIM (p_dba, ‘0x‘), ‘xxxxxxxx‘));
l_str :=
‘datafile# is:‘
|| l_fno
|| CHR (10)
|| ‘datablock is:‘
|| l_bno
|| CHR (10)
|| ‘dump command:alter system dump datafile ‘
|| l_fno
|| ‘ block ‘
|| l_bno
|| ‘;‘;
RETURN l_str;
END;
select getbfno(‘0x00400179‘) bfno from dual;
【oracle】rowid转换rdba,rdba转换为file#block#
标签:rowid rowid转换rdba get_rowid getbfno rdba转换file#block#
原文地址:http://blog.csdn.net/clark_xu/article/details/44749445