DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Rebuild indexes

  1. #1
    Join Date
    Jan 2001
    Posts
    318
    Can someone help me with the script to rebuild indexes ?
    I have oracle 8.0.6 and oracle 8i both. I want to rebuild indexes for both databases.

    My system tablespace is highly fragmented. How do I defragement it ?
    How do I defragement user tablespace too ?

    My email is:
    sonaliak@hotmail.com
    Thanks
    Sonali
    Sonali

  2. #2
    Join Date
    Jan 2000
    Location
    Silver Spring MD USA
    Posts
    105
    ALTER INDEX ____.____ REBUILD TABLESPACE _____;

    You can run a script like:
    SELECT 'ALTER INDEX '||owner||'.'||index_name||' REBUILD TABLESPACE _____;'
    FROM DBA_INDEXES
    WHERE _______;

    with the proper WHERE clause for the indexes in need of rebuilding. If they are in the proper tablespace, you don't need the rebuild clause. Then spool the output and run the spooled file.

    The best way to defragment a tablespace is to export/import.
    However, before you do this, it is important to analyze what caused the fragmentation in the first place, so that you can avoid further fragmentation in the future.

    Good luck

  3. #3
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    you cant defragment system tablespace... not even with EXP/IMP

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