HI all
can anybody tell me about the rebuild all the indexes of the specified schema or specified table. i want single script for that.
thanks in advance
Printable View
HI all
can anybody tell me about the rebuild all the indexes of the specified schema or specified table. i want single script for that.
thanks in advance
Periodically, and typically after large deletes or inserts, it is worth rebuilding indexes.
The SQL for this is:
Alter index <index_name> rebuild;
Alternatively, the following performs the same, but avoids writing to the redo logs and thus speeds up the index rebuild:
Alter index <index_name> rebuild unrecoverable;
To rebuild all indexes
Sql > Set Heading off
Sql > Spool c:\s.sql
SELECT ' ALTER INDEX ' || INDEX_NAME || ' REBUILD ; '
FROM USER_INDEXES
Sql > Spool off
Sql >@ c:\s.sql
Try this