Reorganize all index in SQL Server

Index Maintenance is one of the major task for a DBA. If rate of Index fragmentation increased then index de-fragmentation is become required. So we can use index reorganize option to rebuild all the indexes. Use Index reorganize option when rate of index fragmentation is b/w 10% to  40%.
 
Syntax:
 
Alter Index All On Table_Name Reorganize.
 
Example:
 
ALTER INDEX ALL ON geographicals Reorganize
GO
 
 
Rebuild Index for All tablex in database:
 
Exec sp_msforeachtable 'ALTER INDEX ALL ON ? Reorganize'
GO
 
 
 
Ebook Download
View all
SQL Jobs
Read by 0 people
Download Now!
Learn
View all