# Databases > Oracle rebuild all the indexes of the table or schema

## pande.dhiraj

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

----------


## susarlasireesha

Periodically, and typically after large deletes or inserts, it is worth rebuilding indexes.
The SQL for this is:
Alter index  rebuild;
Alternatively, the following performs the same, but avoids writing to the redo logs and thus speeds up the index rebuild:

Alter index  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

----------

