오라클

Analyze all table and index partitions individually

OEasy 2006. 12. 26. 15:51
rem -----------------------------------------------------------------------
rem Filename:   analpart.sql
rem Purpose:    Analyze all table and index partitions individually
rem Date:       23-Aug-1999
rem Author:     Frank Naude, Oracle FAQ
rem -----------------------------------------------------------------------
set feed off echo off head off trimspool on line 500
spool /tmp/analyze$$.sql
select 'ANALYZE TABLE '||table_owner||'.'||table_name||' partition ('||
       partition_name||') estimate statistics;'
from   sys.dba_tab_partitions
/
select 'ANALYZE INDEX '||index_owner||'.'||index_name||' partition ('||
       partition_name||') estimate statistics;'
from   sys.dba_ind_partitions
/
spool off
set feed on
@/tmp/analyze$$.sql
! rm /tmp/analyze$$.sql