Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: WHEN TO REBUILD

Re: WHEN TO REBUILD

From: Mladen Gogala <mgogala_at_allegientsystems.com>
Date: Wed, 08 Jun 2005 13:13:48 -0400
Message-ID: <42A7274C.8020700@allegientsystems.com>


Seema Singh wrote:

>Hi,
>Does any one has script to findout which indexes need to rebuild in database
>in single run?
>
>

set pagesize 0
set trimout on
set trimspool on
set echo off
spool /tmp/rebuild.sql
select 'alter index '||owner||'.'||index_name||' rebuild;' from dba_indexes where owner not like '%SYS%'; spool off
@/tmp/rebuild

This should satisfy even the keenest index rebuilder. Other then that, why would you want to rebuild indexes?
I don't think that Oracle indexes need regular rebuilding. Index needs to be rebuilt only exceptionally, when
it becomes stale or corrupt. In Oracle9i, even deleted keys can be reused, so the argument from Oracle7 and Oracle8 is no longer true. The script above will rebuild your indexes if you have CTD.

-- 
Mladen Gogala
Oracle DBA
Ext. 121


--
http://www.freelists.org/webpage/oracle-l
Received on Wed Jun 08 2005 - 13:16:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US