Nehru Place IT Hub
Blogged with the Flock Browser
what are we ? we are what we experience. And some more. I bring together here, collective experiences from different parts of life..
alter session set tracefile_identifier='';
--should be replaced with your own identifying name...
alter session set events='10046 trace name context forever, level 8';
set timing on
-- delete all statistics
DECLARE
CURSOR cOwner IS SELECT DISTINCT owner
FROM dba_tables
WHERE owner NOT IN ('SYS','SYSTEM','DBSNMP',);
BEGIN
-- analyze sOwner,compute
FOR rOwner IN cOwner LOOP
DBMS_STATS.DELETE_SCHEMA_STATS
(ownname => rOwner.owner);
END LOOP;
END;
/
select 'END_DATE: '||to_char(sysdate,'dd.mm.yyyy hh24:mi:ss') as end_date from dual;
exit
-- recreate all statistics
DECLARE
CURSOR cOwner IS SELECT DISTINCT owner
FROM dba_tables
WHERE owner NOT IN ('SYS','SYSTEM','DBSNMP',);
BEGIN
-- analyze sOwner,compute
FOR rOwner IN cOwner LOOP
DBMS_STATS.GATHER_SCHEMA_STATS
(ownname => rOwner.owner,
estimate_percent => 99,
block_sample => FALSE,
method_opt => 'FOR ALL COLUMNS SIZE 150',
degree => NULL,
granularity => 'DEFAULT',
cascade => TRUE);
END LOOP;
END;
/
select 'END_DATE: '||to_char(sysdate,'dd.mm.yyyy hh24:mi:ss') as end_date from dual;
exit