Total Pageviews

Thursday, October 12, 2017

How to Check which tables are STALE

select OWNER,TABLE_NAME,PARTITION_NAME,SUBPARTITION_NAME,NUM_ROWS,LAST_ANALYZED from dba_TAB_STATISTICS where owner='&owner' and STALE_STATS='YES';


SOLUTION: If you fount stale tables gather the stats as below.

=== gather stat TABLE====

exec dbms_stats.gather_table_stats (ownname=>'ASHWANI',tabname=>'EMP',estimate_percent=>100);

----gather stat TABLE WITH INDEXES

exec DBMS_STATS.GATHER_TABLE_STATS (ownname => 'ASHWANI' , tabname => 'EMP',cascade => true, estimate_percent => 10,method_opt=>'for all indexed columns size 1', granularity => 'ALL', degree => 1);

--Schema. The Gather Schema Statistics process should be run on a regular basis (weekly at a minimum) and anytime large changes to the data or database take place. 

Example:

exec dbms_stats.gather_schema_stats(ownname => 'ASHWANI', estimate_percent => 25)




No comments:

Post a Comment