what is the difference between object_id and data_object_id?


The object_id is the primary key, the data_object_id is the foreign key to the data segment.

You can find the DDL operation against the object (for instance,
Truncate,Move etc.)by querying the dba_objects with object_id not equal to data_object_id.





引用


Hi Tom,

For some objects in dba_objects, I see object_id is not matching with data_object_id even
when that object is not part of the cluster.

21:35:49 SQL> select count(*) from dba_objects where
data_object_id is not null and
object_name not in (
select distinct table_name from dba_clu_columns)
/

  COUNT(*)
----------
      5930

Can you please explain why they are different and what could cause that.

Thanks.

and we said...

The object_id is the primary key, the data_object_id is the foreign key to the data
segment.

Initially they are "the same"

But any operation that radically changes the data segment - eg: truncate, alter table
exchange partition, etc -- will change the data_object_id -- the data segment the object
points to.


consider:

ops$tkyte@ORA9IR2> create table t ( x int );

Table created.

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> select object_name, object_id, data_object_id
  2    from user_objects
  3   where object_name = 'T';

OBJECT_NAME                     OBJECT_ID DATA_OBJECT_ID
------------------------------ ---------- --------------
T                                   29413          29413

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> truncate table t;

Table truncated.

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> select object_name, object_id, data_object_id
  2    from user_objects
  3   where object_name = 'T';

OBJECT_NAME                     OBJECT_ID DATA_OBJECT_ID
------------------------------ ---------- --------------
T                                   29413          29414

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> alter table t move;

Table altered.

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> select object_name, object_id, data_object_id
  2    from user_objects
  3   where object_name = 'T';

OBJECT_NAME                     OBJECT_ID DATA_OBJECT_ID
------------------------------ ---------- --------------
T                                   29413          29415




Refer Weblink:
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:23417970272903
http://space.itpub.net/17203031/viewspace-690629

你可能感兴趣的:(object)