script to rebuild all indexes
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: script to rebuild all indexes

  1. #1
    Join Date
    Jan 2001
    Posts
    72

    index rebuild

    Currently I rebuild my indexes one at a time. ALter index rebuild.

    Can anyone send me a script that will rebuild all my indexes all at once instead of just one at a time?

  2. #2
    Join Date
    Sep 2000
    Location
    Calcutta / Ahmedabad, India
    Posts
    137
    SQL> spool rebuil.lst
    SQL> select 'alter','index',index_name,'rebuild',';'
    SQL> from dba_indexes where
    SQL> owner='<OWNER NAME>' ;
    SQL> spool off

    open the "rebuild.lst" file

    remove all the lines excepting those starting with "alter"
    save the file as <filename>.sql

    Now Run the file

    SQL> @<filename>.sql
    Suvashish

  3. #3
    Join Date
    Sep 2000
    Location
    Calcutta / Ahmedabad, India
    Posts
    137
    There is a small correction in the last post


    SQL> owner='<OWNER_NAME>';
    Suvashish

  4. #4
    Join Date
    Feb 2001
    Posts
    2

    Exclamation

    i will post you very good solution soon

  5. #5
    Join Date
    Jul 2000
    Posts
    296
    set pages 1000
    set lines 1000
    set echo off
    set heading off
    set feedback off

    spool rebuild.sql

    SELECT 'ALTER INDEX '||owner||'.'||index_name||' REBUILD;'
    FROM dba_indexes
    WHERE owner = 'SCOTT';

    spool off



  6. #6
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    'REBUILD' is not an option on the lower versions of 734. Just a reminder.

  7. #7
    Join Date
    Jul 2000
    Posts
    296
    I don't know in which 7.3 version it's introduced, but before 7.3.4. It works in 7.3.3.6.

    [Edited by akkerend on 02-06-2001 at 01:44 PM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width