8 Appendix
This topic explains the script used to check or remove the histograms on the schema.
Script to Check Histograms on Schema
The following script would have to be executed in the schema:
Syntax
select distinct table_name
from
(select table_name from user_tab_columns where histogram!='NONE')
Should return No RecordsScript to Remove Histograms on Schema
The following script would have to be executed in the schema if there are any rows:
declare
cursor cur_tables is
select distinct table_name from
(select table_name from user_tab_columns where histogram!='NONE' );
begin for rec_tables in cur_tables loop
dbms_stats.gather_table_stats(ownname=>USER,tabname=>rec_ta bles.table_name,METHOD_OPT=>'FOR
ALL COLUMNS SIZE 1',CASCADE=>TRUE,DEGREE=>2,ESTIMATE_PERCENT=>NULL);
end loop;
end;