找出未收集統計資訊,以及統計資訊過期的表

2021-06-28 06:34:35 字數 689 閱讀 2577

下面這個查詢可以找到從未收集過統計資訊或者統計資訊過期的表。

exec dbms_stats.flush_database_monitoring_info;

select owner,table_name,object_type,stale_stats,last_analyzed from

dba_tab_statistics where (stale_stats='yes' or last_analyzed is null) 

and owner not in ('sys', 'system', 'sysman', 'dmsys', 'olapsys', 'xdb','exfsys', 'ctxsys',

'wmsys', 'dbsnmp', 'ordsys', 'outln', 'tsmsys', 'mdsys') and table_name not like 'bin%';

在進行調優之前,我們就要看錶的統計資訊是否過期,如果過期了,cbo就可能選擇錯誤的執行計畫。

select owner,table_name,object_type,stale_stats,last_analyzed from dba_tab_statistics where owner='&owner' and table_name='&table_name';

如何 找出未收集統計資訊,以及統計資訊過期的表

下面這個查詢可以找到從未收集過統計資訊或者統計資訊過期的表。exec dbms stats.flush database monitoring info select owner,table name,object type,stale stats,last analyzed from dba ta...

如何 找出未收集統計資訊,以及統計資訊過期的表

下面這個查詢可以找到從未收集過統計資訊或者統計資訊過期的表。select owner,table name,object type,stale stats,last analyzed from dba tab statistics where stale stats yes or last anal...

Oracle統計資訊收集

統計資訊收集 1 建立分析表 cd oracle home rdbms admin sqlplus as sysdba utlxplan.sql 2 為了方便,可以建立乙個同義表 預設情況下只有sys使用者可以使用 sql create public synonym plan tables for ...