Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Script to generate gather table stats for all the tables which dont have upto date statistics

$
0
0
set serveroutput on
set serveroutput on size 1000000
declare
sql_string varchar2(2000);
CURSOR OBJ IS
select owner,table_name
from dba_tables
where last_analyzed is null
--and OWNER='&owner'
;
begin
for REC1 IN OBJ LOOP
DBMS_OUTPUT.PUT_LINE('EXEC DBMS_STATS.GATHER_TABLE_STATS ('''||REC1.owner||''','''||REC1.table_name||''');');
END LOOP;
END;
/

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>