question

jintana avatar image
jintana asked

MS-SQL Server Index Maintenance Fragmentation

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.
indexes
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Magnus Ahlkvist avatar image
Magnus Ahlkvist answered
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.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image ThomasRushton ♦♦ commented ·
Well, every build of SQL Server from 2005 onwards... But, hey, who's running SQL2000 or before these days? Oh, wait. Damn.
1 Like 1 ·
Magnus Ahlkvist avatar image Magnus Ahlkvist commented ·
Haha, you're right about that. I have been in upgrade Projects where Everything was upgraded from a supported version to the next supported version, just to have as long a support period ahead as possible. But leaving whatever hadn't been supported for ages behind, because... well, it isn't supported anyway, so leaving it behind won't make things worse.
1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.