大于10M表无统计信息的收集

begin

for r in (select tab.owner,tab.TABLE_NAME
from dba_tables tab, dba_segments seg
where tab.TABLE_NAME = seg.segment_name
and tab.OWNER = seg.owner
and seg.segment_type = 'TABLE'
and tab.LAST_ANALYZED is null
and tab.NUM_ROWS=0
and tab.owner in('TBCS')
and seg.bytes / 1024 / 1024 > 10)
loop
begin dbms_output.put_line('exec dbms_stats.GATHER_TABLE_STATS(OWNNAME=>'||''''||r.owner||''''||',TABNAME=>'||''''||r.table_name||''''||',cascade=>TRUE);');
end;
end loop;
end;
/