MS-SQL Server Index Maintenance Fragmentation I have many databases in this Instance I would like to know how to detect which index should rebuild to fresh high water mark 1.Kindly share script to detect fragementation 2.Kindly share scrpt how to rebuild index or how to re-org indexes. Thank you very much.
I Always use Ola Hallengren's scripts for Index Maintenance. They install a stored procedure (and even agent jobs if you choose so in the setup) which takes parameters for thresholds for fragmentation (one threshold for when indexes should be reorganized and one threshold for when indexes should be rebuilt). You find the scripts at
http://ola.hallengren.com These scripts are used by DBAs all over the World and Ola is doing a fantastic job maintaining the scripts, so that they are compatible with more or less every build of SQL Server.