object_id和data_object_id区别与联系

http://www.xifenfei.com/1553.html


object_id和data_object_id区别与联系

链接:http://www.xifenfei.com/1553.html

标题:object_id和data_object_id区别与联系

作者:惜分飞©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]

其实object_id和data_object_id同样是表示数据库对象的一个唯一标志,但是object_id表示的是逻辑 id,data_object_id表示的是物理id。如果一些object没有物理属性的话那它就不存在data_object_id,例如 procedure,function,package,data type,db link,mv定义,view定义,临时表,分区表定义等等这些object都是没有对应着某个segment,因此它们的data_object_id 都为空。

当表刚创建的时候它的object_id和data_object_id都是相等的,但是如果表经过move或truncate等,涉及到segment发生改变后data_object_id将会有变化。

DATA_OBJECT_ID was introduced in 8.0 to track versions of the same segment (certain operations change the version). It is used to discover stale ROWIDs and stale undo records.

SQL> create table xff as select * from dba_objects where rownum<100;
  
Table created
  
SQL> select object_id,data_object_id from user_objects where object_name='XFF';
  
 OBJECT_ID DATA_OBJECT_ID
---------- --------------
    211325         211325
  
SQL> alter table xff move;
  
Table altered
  
SQL> select object_id,data_object_id from user_objects where object_name='XFF';
  
 OBJECT_ID DATA_OBJECT_ID
---------- --------------
    211325         211326
  
SQL> truncate table xff;
  
Table truncated
  
SQL> create index ind_xff on xff(object_id);
  
Index created
  
SQL>  select object_id,data_object_id from user_objects where object_name='IND_XFF';
  
 OBJECT_ID DATA_OBJECT_ID
---------- --------------
    211328         211328
  
SQL> ALTER INDEX IND_XFF REBUILD;
  
Index altered
  
SQL>  select object_id,data_object_id from user_objects where object_name='IND_XFF';
  
 OBJECT_ID DATA_OBJECT_ID
---------- --------------
    211328         211329

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16993226/viewspace-768949/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16993226/viewspace-768949/

你可能感兴趣的:(object_id和data_object_id区别与联系)