SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Michelle's Defragging Script Question


Michelle's Defragging Script Question

Author
Message
dmodersk
dmodersk
SSC-Enthusiastic
SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)

Group: General Forum Members
Points: 122 Visits: 51
I am new to defragging/reindexing. I discovered a script by Michelle Ufford here: http://sqlfool.com/2011/06/index-defrag-script-v4-1/ It looks good. The script itself has instructions on how to call the defrag procedure once its installed, but I'm confused what I would do first. Do I just run the script she wrote as is on my maintenance database?
paul.phillips
paul.phillips
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 50
Running the initial script creates three tables dba_indexDefragLog, dba_indexDefragStatus and dba_indexDefragExclusion, creates a stored procedure [dba_indexDefrag_sp] and adds a function that the stored proc uses.

Once these are in place, simply calling the stored proc would begin defragging every index on every database based on the default settings (which you probably don't want). We've just changed the default @database param to the db we run the script against and added the stored proc to a scheduled task.

Read the comments at the top of the stored proc [dba_indexDefrag_sp] and familiarise yourself with what each parameter does (it is well explained). You'll most likely have no need to change any of them (apart from the @database as mentioned earlier).

It is an excellent script and Michelle deserves all the credit she gets. The one thing that this script doesn't do, that others do, is update the statistics - which is easy enough task to set up separately.

Hope this helps,


Paul
Senior Developer/Reluctant Hybrid DBA

Edit - Just spotted it was an old post - DOH!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search