select 'execute dbms_stats.gather_table_stats('||''''||owner|| ''','''||''||table_name||''''|| ',estimate_percent=>dbms_stats.auto_sample_size,cascade => TRUE);'
from dba_tables
where OWNER not in ('SYS', 'SYSTEM')
group by owner, table_name
having sum(decode(nvl(NUM_ROWS,9999), 9999,1,0)) > 0
Select Distinct 'execute dbms_stats.gather_index_stats('||''''||owner|| ''','''||''||index_name||''''|| ');'
from dba_indexes
where OWNER not in ('SYS', 'SYSTEM')
group by owner, index_name
having sum(decode(nvl(NUM_ROWS,9999), 9999,1,0)) > 0;
Select Distinct 'execute dbms_stats.gather_table_stats('||''''||table_owner|| ''','''||''||table_name||''''|| ',estimate_percent=>dbms_stats.auto_sample_size,cascade => TRUE);'
from dba_tab_partitions
where table_OWNER not in ('SYS', 'SYSTEM')
group by table_owner, table_name
having sum(decode(nvl(NUM_ROWS,9999), 9999,1,0)) > 0;
No comments:
Post a Comment