June 3, 2014 at 8:16 am
hi there
i want to write the script which can Reorganize all indexes in each database and i have 75 servers and every server have 3 or 4 user databases and few read only databases...
can any one help me in this!!
June 3, 2014 at 8:33 am
This should help you
http://sqlfool.com/2011/06/index-defrag-script-v4-1/
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
June 3, 2014 at 10:06 pm
Why not use something thats already around ?
Ive used the scripts from Ola Hallengren with great success in the past.
June 3, 2014 at 11:55 pm
fawad.majid (6/3/2014)
hi therei want to write the script which can Reorganize all indexes in each database and i have 75 servers and every server have 3 or 4 user databases and few read only databases...
can any one help me in this!!
Hello,
If you really want to reorganize/rebuild all indexes that can be done quite easily with something like this:
EXEC Sp_MsForEachTable @command1="SET QUOTED_IDENTIFIER ON; ALTER INDEX ALL ON ? REORGANIZE";
If you're actually looking for a smarter solution that'll do rebuild or reorganize by fragmentation percentage etc, then I'll second the previously made suggestion to look at some of the existing solutions, I personally like Ola Hallengrens scripts.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply