0
点赞
收藏
分享

微信扫一扫

查看统计信息是否过期及原因

Xin_So 2022-07-27 阅读 59

12c+适用

select table_name,
partition_name,
table_owner,
mods,
num_rows,
case
when stale_reason_code is null
then to_char('---')
else XMLTYPE(replace(DBMS_STATS_INTERNAL.GET_STALE_REASON(stale_reason_code), ' ', '')).extract('/stalenessreason/reason/text()').getstringval()
end stale_reason
from (
select table_name,
t.partition_name,
t.table_owner,
(v.inserts + v.deletes + v.updates) mods,
t.num_rows,
CASE
WHEN t.last_analyzed IS NULL THEN NULL
ELSE ( dbms_stats_internal.is_stale(
o.object_id,
NULL,
NULL,
(v.inserts + v.deletes + v.updates),
t.num_rows,
v.flags
) )
END stale_reason_code
from sys.mon_mods_all$ v,
dba_objects o,
dba_tab_partitions t
where v.obj# = o.object_id
and o.SUBOBJECT_NAME = t.partition_name
and o.object_name = t.table_name
and o.owner = t.table_owner);

举报

相关推荐

0 条评论