RE: Convert ROWID from Leaf Block Dump

  • From: Jonathan Lewis <jonathan@xxxxxxxxxxxxxxxxxx>
  • To: "oracle-l@freelists org" <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 23 Feb 2016 18:00:32 +0000



I can't find the bit in the manual (or the right manual), or my notes that 
describe this, so I have to do it from memory:

The first 10 bits (left to right) are the relative file number, so the 01 00 is 
actually 10 bits then 6 bits
The 1 is actually the 3rd lowest bit in the 10bit file number - which is why it 
represents 4.

The lower 6 bits in the "01 00" are the top six bits of at 22-bit block number, 
so if you had had 01 02 02 f2 00 1e that would have identified block 2^17 + 754

The last 2 bytes (16 bits) gives the row within block - although there is a 
limit of 4095 for the row number, so only the lowest 12 bits are used.  I don't 
think the final 4 bits are used at all.


01 00 02 f2 00 1e


Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
@jloracle
________________________________
From: Michael Cunningham [napacunningham@xxxxxxxxx]
Sent: 23 February 2016 17:37
To: Jonathan Lewis
Cc: oracle-l@freelists org
Subject: Re: Convert ROWID from Leaf Block Dump

Thanks Jonathan, that got me much closer.

From the rowid entry in the Leaf Block Dump
col 1; len 6; (6):  01 00 02 f2 00 1e

I see that:
    "00 1e" = 30 which is the row# in the block
    "02 f2" = 754 which is the block#

I'm not sure what the "01 00" converts to or if it is actually 2 different 
pieces of my puzzle.

If my understanding is correct, I still need object_number and relative_fno to 
create a usable ROWID. I can't find anywhere in the index treedump, or any 
blockdump's where I can come up with that information.

My dilemma is how exactly does the Leaf Block provide the information to 
generate the ROWID.

Any further help will be greatly appreciated.

Michael


On Tue, Feb 23, 2016 at 8:51 AM, Jonathan Lewis 
<jonathan@xxxxxxxxxxxxxxxxxx<mailto:jonathan@xxxxxxxxxxxxxxxxxx>> wrote:


Look at package dbms_rowid.
  1  select
  2     dbms_rowid.rowid_object('AAAFDFAAEAAAALyAAe') data_object_id ,
  3     dbms_rowid.rowid_relative_fno('AAAFDFAAEAAAALyAAe') ts_relative_file,
  4     dbms_rowid.rowid_block_number('AAAFDFAAEAAAALyAAe') block_number,
  5     dbms_rowid.rowid_row_number('AAAFDFAAEAAAALyAAe') row_in_block
  6* from dual
SQL> /

DATA_OBJECT_ID TS_RELATIVE_FILE BLOCK_NUMBER ROW_IN_BLOCK
-------------- ---------------- ------------ ------------
         20677                4          754           30

The file and block number procedures have a second parameter to tell them 
whether the object is in a smallfile or bigfile tablespace (default small); 
there's also an "absolute" file number procedure but you have to know the 
schema and object name - which you can derive from the data_object_id.


Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
@jloracle
________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx<mailto:oracle-l-bounce@xxxxxxxxxxxxx
[oracle-l-bounce@xxxxxxxxxxxxx<mailto:oracle-l-bounce@xxxxxxxxxxxxx>] on behalf 
of Michael Cunningham 
[napacunningham@xxxxxxxxx<mailto:napacunningham@xxxxxxxxx>]
Sent: 23 February 2016 16:35
To: oracle-l@freelists org
Subject: Convert ROWID from Leaf Block Dump

Hello list, does anyone know how to convert the rowid info in a leaf block dump 
to a real rowid?

For example, I have this
col 1; len 6; (6):  01 00 02 f2 00 1e

The rowid for the row in the table is AAAFDFAAEAAAALyAAe.

I'm looking for the formula to do the conversion. Or at least something that 
gets me to this.

I'll keep looking for the solution, but I thought I'd ask.

--
Michael Cunningham



--
Michael Cunningham

Other related posts: