spool gatherstats_on_table_name.log
-- TABLE
set timing on;
select name from v$database;
exec DBMS_STATS.GATHER_TABLE_STATS (ownname => 'SCHEMA_NAME', cascade => true, tabname => 'TABLE_NAME1', estimate_percent => 10,method_opt=>'for all indexed columns size auto', granularity => 'ALL', degree => 32);
exec DBMS_STATS.GATHER_TABLE_STATS (ownname => 'SCHEMA_NAME', cascade => true, tabname => 'TABLE_NAME2', estimate_percent => 10,method_opt=>'for all indexed columns size auto', granularity => 'ALL', degree => 32);
spool off

-- SCHEMA
spool gatherstats_on_schema_name.log
set timing on;
select name from v$database;
exec DBMS_STATS.GATHER_SCHEMA_STATS (ownname => 'SCHEMA_NAME', cascade => true, estimate_percent => 10,method_opt=>'for all indexed columns size auto', granularity => 'ALL', degree => 48);
spool off

hostgator