20171229V$DB_OBJECT_CACHE type='INDEX'

简介: [20171229]V$DB_OBJECT_CACHE type='INDEX'.txt --//前几天一直在使用V$DB_OBJECT_CACHE视图查询FULL_HASH_VALUE,验证自己推断FULL_HASH_VALUE如何计算.

[20171229]V$DB_OBJECT_CACHE type='INDEX'.txt

--//前几天一直在使用V$DB_OBJECT_CACHE视图查询FULL_HASH_VALUE,验证自己推断FULL_HASH_VALUE如何计算.
--//我无意中发现一个奇怪的现象,就是查询这个视图type='INDEX',除了owner='SYS'外,其它owner几乎无法查询到.
--//自己今天做一些探究.

1.环境:
SCOTT@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> select * from V$DB_OBJECT_CACHE where type='INDEX' and owner<>'SYS';
no rows selected

--//我的测试环境type='INDEX' and owner<>'SYS'一个都没有.

SCOTT@book> select owner,name,namespace,type,hash_value,full_hash_value,status from V$DB_OBJECT_CACHE where  TYPE='INDEX' and owner='SYS' and rownum<=5;
OWNER  NAME                 NAMESPACE  TYPE  HASH_VALUE FULL_HASH_VALUE                  STATUS
------ -------------------- ---------- ----- ---------- -------------------------------- ------
SYS    I_OBJ#_INTCOL#       INDEX      INDEX 3598591747 434a51e7d9b780fb00a6906ed67e2703 VALID
SYS    I_H_OBJ#_COL#        INDEX      INDEX 1338804478 31fb0006138102d78beac8f44fcc88fe VALID
SYS    I_HH_OBJ#_INTCOL#    INDEX      INDEX 2773272724 19a7b13c095ea769459763c8a54cc894 VALID
SYS    I_HH_OBJ#_COL#       INDEX      INDEX 1377242932 ad9ade920cb128a84a880e5e52170f34 VALID
SYS    I_TAB_STATS$_OBJ#    INDEX      INDEX 1950176892 55daa9210606e2e2020b4252743d567c VALID

--//我仔细检查一个索引发现一个规律,就是这些索引对应的表都是分区表或者是cluster表,非分区仅仅
--//IND_STATS$,TAB_STATS$,HIST_HEAD$,FIXED_OBJ$,HISTGRM$(cluster表).
--//我也查询生产系统,普通用户的索引在V$DB_OBJECT_CACHE视图中也不存在,因为我们开发不用分区表.

select owner,table_name,cluster_name,PARTITIONED from dba_tables where  (owner,table_name) in
(SELECT table_owner, table_name
  FROM dba_indexes
WHERE (owner, index_name) IN (SELECT owner, name
                                 FROM V$DB_OBJECT_CACHE
                                WHERE TYPE = 'INDEX' AND owner = 'SYS'));

OWNER  TABLE_NAME                     CLUSTER_NAME                   PAR
------ ------------------------------ ------------------------------ ---
SYS    WRH$_SERVICE_STAT                                             YES
SYS    WRH$_ACTIVE_SESSION_HISTORY                                   YES
SYS    WRH$_SERVICE_WAIT_CLASS                                       YES
SYS    WRH$_WAITSTAT                                                 YES
SYS    WRH$_DB_CACHE_ADVICE                                          YES
SYS    IND_STATS$                                                    NO
SYS    WRH$_SQLSTAT                                                  YES
SYS    WRH$_TABLESPACE_STAT                                          YES
SYS    WRH$_ROWCACHE_SUMMARY                                         YES
SYS    WRH$_PARAMETER                                                YES
SYS    TAB_STATS$                                                    NO
SYS    WRH$_MVPARAMETER                                              YES
SYS    HISTGRM$                       C_OBJ#_INTCOL#                 NO
SYS    HIST_HEAD$                                                    NO
SYS    WRH$_SYS_TIME_MODEL                                           YES
SYS    WRH$_SYSSTAT                                                  YES
SYS    WRH$_SYSTEM_EVENT                                             YES
SYS    WRH$_EVENT_HISTOGRAM                                          YES
SYS    WRH$_FILESTATXS                                               YES
SYS    WRH$_SGASTAT                                                  YES
SYS    FIXED_OBJ$                                                    NO
SYS    WRH$_LATCH                                                    YES
SYS    WRH$_LATCH_MISSES_SUMMARY                                     YES
SYS    WRH$_OSSTAT                                                   YES
SYS    WRH$_SEG_STAT                                                 YES
25 rows selected.

--//难道仅仅分区表的索引才会在 V$DB_OBJECT_CACHE存在吗?而且其对应的基表是sys.x$kglob,仅仅加一个条件where kglnaobj IS NOT NULL.

2.测试在普通用户建立分区表以及索引看看.

create table users
(region_code varchar2(3),
username varchar2(30),
account_status varchar2(32),
created date,
profile varchar2(128))
partition by range (region_code)
(partition a_m values less than ('N'),
partition n_r values less than ('S'),
partition s_z values less than (MAXVALUE));

insert into users select substr(username,1,3), username, account_status, created, profile from dba_users;

exec dbms_stats.gather_table_stats('','USERS');

3.建立索引看看:
SCOTT@book> create unique index users_username_u1 on users(username) global;
Index created.

SCOTT@book> select owner,name,namespace,type,hash_value,full_hash_value,status from V$DB_OBJECT_CACHE where  TYPE='INDEX' and owner='SCOTT' and NAME='USERS_USERNAME_U1' and rownum<=5;
OWNER  NAME                 NAMESPACE  TYPE   HASH_VALUE FULL_HASH_VALUE                  STATUS
------ -------------------- ---------- ------ ---------- -------------------------------- ------
SCOTT  USERS_USERNAME_U1    INDEX      INDEX  2235571155 eaad7ced006dd3d2a5f20cc085401bd3 VALID

SCOTT@book> drop index users_username_u1;
Index dropped.

SCOTT@book> select owner,name,namespace,type,hash_value,full_hash_value,status from V$DB_OBJECT_CACHE where  TYPE='INDEX' and owner='SCOTT' and NAME='USERS_USERNAME_U1' and rownum<=5;
OWNER  NAME                 NAMESPACE  TYPE  HASH_VALUE FULL_HASH_VALUE                  STATUS
------ -------------------- ---------- ----- ---------- -------------------------------- ------
SCOTT  USERS_USERNAME_U1    INDEX      INDEX 2235571155 eaad7ced006dd3d2a5f20cc085401bd3 UNKOWN
--//status=UNKOWN

SCOTT@book> create  index users_username_u1 on users(username) global;
Index created.

SCOTT@book> select owner,name,namespace,type,hash_value,full_hash_value,status from V$DB_OBJECT_CACHE where  TYPE='INDEX' and owner='SCOTT' and NAME='USERS_USERNAME_U1' and rownum<=5;
OWNER  NAME                 NAMESPACE  TYPE  HASH_VALUE FULL_HASH_VALUE                  STATUS
------ -------------------- ---------- ----- ---------- -------------------------------- -------
SCOTT  USERS_USERNAME_U1    INDEX      INDEX 2235571155 eaad7ced006dd3d2a5f20cc085401bd3 VALID

4.继续测试,建立本地索引看看:

SCOTT@book> drop index users_username_u1;
Index dropped.

SCOTT@book> create index users_username_l1 on users(username) local;
Index created.

SCOTT@book> select owner,name,namespace,type,hash_value,full_hash_value,status from V$DB_OBJECT_CACHE where  TYPE='INDEX' and owner='SCOTT' and NAME='USERS_USERNAME_L1' and rownum<=5;
OWNER  NAME                 NAMESPACE  TYPE  HASH_VALUE FULL_HASH_VALUE                  STATUS
------ -------------------- ---------- ----- ---------- -------------------------------- ------
SCOTT  USERS_USERNAME_L1    INDEX      INDEX 2934347769 f6834aac7908d9d4184ee11daee697f9 VALID


--//似乎仅仅分区表出现该视图中,而剩下的表非常特殊:

select owner,table_name,cluster_name,PARTITIONED from dba_tables where PARTITIONED<>'YES' and (owner,table_name) in
(SELECT table_owner, table_name
  FROM dba_indexes
WHERE (owner, index_name) IN (SELECT owner, name
                                 FROM V$DB_OBJECT_CACHE
                                WHERE TYPE = 'INDEX' ));

OWNER  TABLE_NAME CLUSTER_NAME                   PAR
------ ---------- ------------------------------ ---
SYS    IND_STATS$                                NO
SYS    TAB_STATS$                                NO
SYS    HISTGRM$   C_OBJ#_INTCOL#                 NO
SYS    HIST_HEAD$                                NO
SYS    FIXED_OBJ$                                NO

--//也许这些表非常特殊吧,视乎都是表和索引直方图的统计表.因为你分析表,一些对象sql语句要重新分析建立新执行计划等等.那位能这个问题讲清楚....^_^.

目录
相关文章
|
1月前
|
Python
通过 type 和 object 之间的关联,进一步分析类型对象
通过 type 和 object 之间的关联,进一步分析类型对象
54 3
|
3月前
|
Docker 容器
成功解决:Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but
这篇文章讨论了在使用Docker启动Elasticsearch容器时遇到的一个具体问题:由于配置文件`elasticsearch.yml`解析出错导致容器启动失败。文章提供了详细的排查过程,包括查看容器的日志信息、检查并修正配置文件中的错误(特别是空格问题),并最终成功重新启动了容器。
|
3月前
|
JSON 数据格式 Python
【python】解决json.dump(字典)时报错Object of type ‘float32‘ is not JSON serializable
在使用json.dump时遇到的“Object of type ‘float32’ is not JSON serializable”错误的方法,通过自定义一个JSON编码器类来处理NumPy类型的数据。
141 1
|
4月前
|
JSON 前端开发 数据格式
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
83 0
|
6月前
|
JavaScript
Vue报错 Invalid default value for prop “list“: Props with type Object/Array must use a factory
Vue报错 Invalid default value for prop “list“: Props with type Object/Array must use a factory
318 0
|
6月前
R语言ggsurvplot绘制生存曲线报错 : object of type ‘symbol‘ is not subsettab
R语言ggsurvplot绘制生存曲线报错 : object of type ‘symbol‘ is not subsettab
|
6月前
FeignClient【问题】Cannot deserialize value of type``from Object value (token `JsonToken.START_OBJECT`)
FeignClient【问题】Cannot deserialize value of type``from Object value (token `JsonToken.START_OBJECT`)
801 0
|
6月前
|
JavaScript
[Vue warn]: Method “components“ has type “object“ in the component definition. Did you reference the
[Vue warn]: Method “components“ has type “object“ in the component definition. Did you reference the
|
JSON 数据格式
TypeError: Object of type ‘float32‘ is not JSON serializable
TypeError: Object of type ‘float32‘ is not JSON serializable
205 0
|
Python
AttributeError: type object ‘Image‘ has no attribute ‘open‘
原因分析:Image调用顺序出错,因为第一行的from PIL import Image与第二行tkinter import *冲突,tkinter中也含有Image类,所以你使用的是tkinter.Image
250 0

热门文章

最新文章