How to find the tables that have stale statistics?
SET SERVEROUTPUT ON
DECLARE
ObjList dbms_stats.ObjectTab;
BEGIN
dbms_stats.gather_database_stats(objlist=>ObjList, options=>'LIST STALE');
FOR i in ObjList.FIRST..ObjList.LAST
LOOP
dbms_output.put_line(ObjList(i).ownname || '.' || ObjList(i).ObjName || ' ' || ObjList(i).ObjType || ' ' || ObjList(i).partname);
END LOOP;
END;
/
ref: http://oraclespin.wordpress.com/2009/04/19/how-to-find-the-tables-that-have-stale-statistics/
DBMS_STATS.GATHER_SCHEMA_STATS(ownname=>'AR_SILVER1_AUTOSLIM', objlist=>ObjList, options=>'LIST STALE');
No comments:
Post a Comment