DBA_OBJECTS object_id data_object_id

OBJECT_ID   Dictionary object number of the object

DATA_OBJECT_ID  Dictionary object number of the segment that contains the object

Note: OBJECT_ID and DATA_OBJECT_ID display data dictionary metadata. Do not confuse these numbers with the unique 16-byte object identifier (object ID) that Oracle assigns to row objects in object tables in the system.

Tom:

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

returned by dbms_rowid is data_object_id not object_id

object_id is logical id

data_object_id is physical id

The data object id is assigned at creation time and does not change
unless the object is dropped and recreated. The data_object_id is also
assigned at creation time but over time the segment used to store the
object can be changed

from: http://performance-insight.com/html/ora3/back/Oracle9i_12.html

Object ID
Object ID is a number to uniquely identify Oracle object. In previous issues, we analyzed X$BH to examine object on database buffer. X$BH also contains a column to uniquely identify an object.

I executed following SQL to analyze database buffer several times.

SQL> select
  2   o.object_name, blsiz , count(*) blocks , lru_flag , tch, state
  3  from x$bh b , dba_objects o
  4  where b.obj = o.object_id
  5    and o.object_name in ('BLOCK4','BLOCK4_IDX')
  6  group by b.blsiz, o.object_name, lru_flag, tch, state;

I have to confess that this SQL is not quite correct.

Table and index exist as follows, for example.

# Find an object starting with SUMMER

SQL> select object_id, data_object_id, object_name from dba_objects
  2  where object_name like 'SUMMER%';

 OBJECT_ID DATA_OBJECT_ID OBJECT_NAME
---------- -------------- --------------------
     43064          43064 SUMMER
     43065          43065 SUMMER_IDX

SUMMER_IDX is an index in SUMMER table.

OBJECT_ID and DATA_OBJECT_ID are exactly the same. Of course, corresponding object numbers on database buffer are exactly the same.

SQL> select obj, count(1) from x$bh
  2  where obj in (43064,43065,43066,43067)
  3  group by obj;

       OBJ   COUNT(1)
---------- ----------
     43064         16
     43065         21

*As DBJ condition, previous object numbers and 
other two numbers are specified.
I will talk about these two numbers (43066, 43067)
later.

Now, I truncate this object (SUMMER) to examine how object number is changed.

SQL> truncate table summer;

Table truncated


SQL> select object_id, data_object_id, object_name from dba_objects
  2  where object_name like 'SUMMER%';

 OBJECT_ID DATA_OBJECT_ID OBJECT_NAME
---------- -------------- --------------------
     43064          43067 SUMMER
     43065          43066 SUMMER_IDX

By truncating a table, DATA_OBJECT_ID of an index in a table is changed.
DATA_OBJECT_ID is an ID to manage object version. Every time, TRUNCATE is executed, this number increases. The largest number (OBJECT_ID or DATA_OBJECT_ID) + 1 is a number to be allocated.

After TRUNCATE, dictionary is altered. However, actual data is not deleted. This means that information in regard to ROLLBACK and REDO is not created in each row of a table. If there is a large number of data, performance is quite fast. However, this doesn't mean old data is deleted.
Such process, version management, is therefore necessary. OBJ column in X$BH indicates DATA_OBJ_ID.

Remarkable thing is that DATA_OBJECT_ID of an index is smaller. I assume that after index is truncated, table is also truncated.

In addition, as package doesn't need to manage version, DATA_OBJ_ID is NULL.

SQL> select object_name, object_id, data_object_id, object_type from dba_objects
  2  where object_type='PACKAGE'

OBJECT_NAME                     OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------------------------------ ---------- -------------- ------------------
HTTP_EXP                            19168                PACKAGE
HTTP_SECURITY_CASCADE               19150                PACKAGE
IFR_EXP                             19169                PACKAGE
IFR_PACKAGE                         19082                PACKAGE
INITJVMAUX                           5214                PACKAGE
IST_ENGINE90                        23788                PACKAGE
 .
 .

OBJECT_ID is not changed unless it is dropped. OK, let's take a look at the status of database buffer after TRUNCATE.

SQL> select obj, count(1) from x$bh
  2  where obj in (43064,43065,43066,43067)
  3  group by obj;

       OBJ   COUNT(1)
---------- ----------
     43066          1
     43067          3

This is not a value in OBJECT_ID column in DBA_OBJECT, but DATA_OBJECT_ID. I specify 43066 and 43067 as OBJ condition in SQL because I estimated that one would be added to DATA_OBJ_ID.

That's it for today.

Yoshihiro Uratsuji

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一、DBA最常用的数据字典 dba_data_files:通常用来查询关于数据库文件的信息 dba_db_links:包括数据库的所有数据库链路,也就是databaselinks。 dba_extents:数据库所有分区的信息 dba_free_space:所有表空间的自由分区 dba_indexs:关于数据库所有索引的描述 dba_ind_columns:在所有表及聚集上压缩索引的列 dba_objects:数据库所有的对象 dba_rollback_segs:回滚段的描述 dba_segments:所有数据库段分段的存储空间 dba_synonyms:关于同义词的信息查询 dba_tables:数据库所有数据表的描述 dba_tabespaces:关于表空间的信息 dba_tab_columns:所有表描述、视图以及聚集的列 dba_tab_grants/privs:对象所授予的权限 dba_ts_quotas:所有用户表空间限额 dba_users:关于数据的所有用户的信息 dba_views:数据库所有视图的文本 二、DBA最常用的动态性能视图 v$datafile:数据库使用的数据文件信息 v$librarycache:共享池SQL语句的管理信息 v$lock:通过访问数据库会话,设置对象锁的所有信息 v$log:从控制文件提取有关重做日志组的信息 v$logfile有关实例重置日志组文件名及其位置的信息 v$parameter:初始化参数文件所有项的值 v$process:当前进程的信息 v$rollname:回滚段信息 v$rollstat:联机回滚段统计信息 v$rowcache:内存数据字典活动/性能信息 v$session:有关会话的信息 v$sesstat:在v$session报告当前会话的统计信息 v$sqlarea:共享池使用当前光标的统计信息,光标是一块内存区域,有Oracle处理SQL语句时打开。 v$statname:在v$sesstat报告各个统计的含义 v$sysstat:基于当前操作会话进行的系统统计 v$waitstat:出现一个以上会话访问数据库的数据时的详细情况。当有一个以上的会话访问同一信息时,可出现等待情况。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值