Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Michelle's Defragging Script Question Expand / Collapse
Posted Thursday, August 21, 2014 2:23 PM


Group: General Forum Members
Last Login: Yesterday @ 2:16 PM
Points: 11, Visits: 34
I am new to defragging/reindexing. I discovered a script by Michelle Ufford here: 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?
Post #1605996
Posted Wednesday, April 15, 2015 3:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, May 21, 2015 2:56 AM
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,

Senior Developer/Reluctant Hybrid DBA

Edit - Just spotted it was an old post - DOH!
Post #1677210
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse