Quick experiment: As mentioned in a previous post, the an Oracle Physical ROWID is 18 bytes laid out in the following manner:

  • Letters 1-6 = the OBJECT_ID
  • Letters 7-9 = the relative FILE_ID
  • Letters 10-15 = the BLOCK within the file
  • Letters 16-18 = the ROW within the block

But!  There are TWO different object ID’s associated with a table…one for the table itself, another for the table segment ( select object_id, data_object_id from dba_objects ).

So which one does a ROWID point to?

Well, we know that if we create a table with a row and truncate it, that the DATA_OBJECT_ID changes, but the OBJECT_ID does not.

Therefore, if we have a table with a record, and we examine the first 6 bytes of the record’s ROWID…if we truncate the table, and then re-insert the record, then….

  • If the first 6 bytes pointed to the OBJECT_ID, we would expect the first 6 bytes to have *not* changed
  • If the first 6 bytes pointed to the DATA_OBJECT_ID, we would expect the first 6 bytes to have changed.

Let’s give it a whirl!

 

ANSWER: It points to the DATA_OBJECT_ID.  You can see that the DATA_OBJECT_ID increments by one (from 93929 to 92930) and the first six bytes of the ROWID also increment by one (from AAAW7p to AAAW7q).