• Nadrek (11/2/2012)


    It is almost never recommended to shrink database or log files, even less likely to need them done all at once, and absolutely not in a scheduled job. Shrinking log files creates filesystem level fragmentation as the logs keep growing again. If your autogrow settings are too small, this can be a serious problem - see Kimberly Tripp's article http://www.sqlskills.com/blogs/kimberly/post/Transaction-Log-VLFs-too-many-or-too-few.aspx

    Additionally, this shrink doesn't account for Transaction log backup first for non-simple mode databases or the repeated cycles often required to move the active log VLF away from the middle or end.

    Hi All

    The idea of this script is to be used on testing and developing environments. Of course you should never shrink LOG files on production environment, except in emergent cases.

    I here want to share my experience with this, because parts of my work is restoring databases every day, and making massive inserts and updates, so that the LOG file can grow too much ... and I find this script useful. Once again it's purpose was not intended for production environments.

    Thank you

    IgorMi

    Igor Micev,My blog: www.igormicev.com