If you describe the dba_objects, you will find two IDs called: object_id & data_object_id, so , what is the difference between them?

object_id is the primary key. Any object will have object_id irrespective, if it has an associated segment or not. For example, sequence, package, synonym are all objects with object_id but without any physical segments.
Initially, when you create and object (like table), both the object_id and data_object_id are the same, but there are some operations that change the data_object_id, like:
truncate table;
alter table move;
alter table exchange partition;
in case the table is part of a cluster, the data_object_id will point to the cluster segment.
So, we can assume that the data_object_id is logically a segment_id, and if the segment changed physically, the segment_id will be changed also.
Let us have some examples:




A final remark, buffers at the buffer cache are associated with segments not objects.
SELECT COUNT (*) FROM v$bh bc, user_objects obj WHERE bc.objd = obj.data_object_id AND object_name = ‘TT1’;

The above examples are against database version 12.2 (Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production). You may get different results from different or old versions.

Donate to support our blogging work
$1.00
Thanks
Ahmed