Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle manually update statistics on all tables

Tags:

Is there a way to update all statistics for all tables regardless of the owner?

I found this sniplet, but I'm not sure if this will grab all tables....

BEGIN    FOR A IN ( SELECT owner FROM SYS.all_tables ) LOOP       execute immediate         EXEC dbms_stats.gather_schema_stats( 'A.owner', cascade='TRUE');    END LOOP; END; 
like image 448
Tom Avatar asked May 05 '13 02:05

Tom


1 Answers

Use DBMS_STATS.GATHER_DATABASE_STATS:

begin     dbms_stats.gather_database_stats; end; / 
like image 130
Jon Heller Avatar answered Oct 06 '22 06:10

Jon Heller