defrag tool on MDF and LDF files?

  • t.walker (2/23/2009)


    Its free...

    http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx

    There is also a tool called DiskView.exe which visualises the fragmentation.

    I just did a smallish test defragmenting a 5GB MDF in a dozen pieces on a highly fragmented drive, and it didn't do anything, saying that the file could not be defragmented, so I suspect the answer to your second question is no. It did a much better job wth smaller files.

    Looks like a useful tool with some limitations. Thanks for the tip jmoss111!

    I tried it on a 24GB file and got the same result so i used diskeeper instead.

    Alex S
  • Thanks folks.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Just use JKDefrag: http://www.kessels.com/JkDefrag/index.html.

    JkDefrag is a disk defragmenter and optimizer for Windows 2000/2003/XP/Vista/2008/X64. Completely automatic and very easy to use, fast, low overhead, with several optimization strategies, and can handle floppies, USB disks, memory sticks, and anything else that looks like a disk to Windows. Included are a Windows version, a commandline version (for scheduling by the task scheduler or for use from administrator scripts), a screensaver version, a DLL library (for use from programming languages), versions for Windows X64, and the complete sources.

    and

    JkDefrag is based on the standard defragmentation API by Microsoft, a system library that is included in Windows 2000, 2003, XP, Vista, and 2008. Most defragmenters are based on this API, including the free defragmenter that comes with Windows and many commercial defragmenters. Basically all JkDefrag does is send "move this file to that location" commands to the API. JkDefrag does not modify the disk by itself, and is therefore extremely solid.

    I use it since a while now. Really good in command line mode.

    Regards.

    --
    Philippe RUELLO
    Database Project Manager

  • jmoss111 (2/13/2009)


    I run contig.exe on specific databases to keep the files in one piece.

    Regards,

    Jim

    Right-O. Download Mark Russinovitch's CONTIG utility. Run it specifically against the .MDF file (then the LDF file as well). The DB does not need to go offline.

    The 100Gb MDF I defragged had 94 "fragments" - reduced to 2 after I created enough free space on the disk to fit the temporary file it builds.

    Thumbs up to Mark of Microsoft!

  • Not sure about the third-party tools but thought I'd chime in. I use the native-OS defragmenter. Usually about once a year, maybe a little longer than that, on the entire partition. Typically done when I'm doing other maintenance on the box and have a nice little outage window in plae. I always ensure SQL is offline and that I have a valid backup before running the process. Maybe a little anal on my part but, as always, better safe than sorry. It does seem to provide a wee bit of a performance boost as well - IMO.

    -- You can't be late until you show up.

  • Nothing wrong with defrag the entire drive, or using the native defragger! That is, if you can afford the time and taking MSSSQL down.

    Having used the Russinovich CONTIG.EXE util on just the problem MDF file without having to stop the MSSSQL server or even take the DB offline, I am a convert.

    Even thus, I did it on a Sunday while there was less of a chance for BI reports or ETLs interfering.

    I also think there was a tiny perf improvement after that - will have to do it again!

  • I schedule contig to run weekly

  • I noticed that this is an old post. The latest build of Diskeeper 2009 will not crash your SQL database. It should also be noted that Diskeeper can be run in automatic mode so it will defragment whenever there are available resources on the server.

    To download the latest trial version of Diskeeper, please go to http://www.diskeeper.com.

Viewing 8 posts - 16 through 22 (of 22 total)

You must be logged in to reply to this topic. Login to reply