Script:Translate RDBA relative data block address
-- scripts/admin/rdba/rdba_to_file_block.sql select trunc( to_number('&rdba','XXXXXXXX') / power(2,22) ) as rfile# , trunc(to_number('&rdba','XXXXXXXX')- trunc( to_number('&rdba','XXXXXXXX') / power(2,22))*power(2,22) ) as block# from dual / 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('0x00400009') from dual;
Comment