Ideal maintenance for SQL SERVER 2005

Last post 05-22-2008 3:36 PM by Ola Hallengren. 5 replies.
Page 1 of 1 (6 items)
Active Topics My Discussions Unanswered Sort Posts: Previous Next
  • 05-22-2008 8:14 AM

    Ideal maintenance for SQL SERVER 2005

    All, I do not like using the native sql server 2005 maintenance plans but rather script out tasks to perform maintenance.

    I do the following...

    1. Backup databases nightly (full) using Redgate.
    2. 15 minute t-log backups using Redgate.
    3. Defrag any index greater than 30% fragmentation rate every night (the logs grow so large though).
    4. Weekly full index rebuilds online.
    5. Run Checkdb weekly.

    I am thinking that is incomplete and I am curious what others use or any suggestions on how to really make sure things are zen like...

     Thanks,

    Bobby Johsnon


     

  • 05-22-2008 11:28 AM In reply to

    Re: Ideal maintenance for SQL SERVER 2005

     To me is fine.

    May be in 3)

    Update statistics on most important tables.  

    Luis Martin
    Moderator
    SQL-Server-Performance.com

    When the power of love overcomes the love of the power, the world will know peace.

    J. Hendrix


    All postings are provided “AS IS” with no warranties for accuracy.
  • 05-22-2008 2:04 PM In reply to

    Re: Ideal maintenance for SQL SERVER 2005

    Maybe you should consider daily differential backups. This will simplify and reduce the time needed for a point in time restore.

    I also thought about the weekly index online rebuild job. You have to think about that indexes (or tables for clustered indexes) with LOB columns can not be rebuilt online.

    It could also be that you're rebuilding some tables week after week that are not fragmented. Maybe you should consider only rebuilding indexes with fragmentation.

    I have a stored procedure that you could use to dynamically rebuild / reorganize your indexes.
    http://blog.ola.hallengren.com/blog/_archives/2008/1/1/3440068.html

    Ola Hallengren
    http://ola.hallengren.com

  • 05-22-2008 3:06 PM In reply to

    Re: Ideal maintenance for SQL SERVER 2005

    I do update stats. Just forgot to mention. I don't need to do anything else like rebuild procedures or anything else of that sort?  

  • 05-22-2008 3:09 PM In reply to

    Re: Ideal maintenance for SQL SERVER 2005

     I do like the diff backups idea. It makes life much easier when dealing with 15 minute t-log backups. As far as index fragmentation goes, I scan all indexes that have greater 30% fragmentation and only do those. This machine is 24/7 and just can't be offline but for a few times during the year.

  • 05-22-2008 3:36 PM In reply to

    Re: Ideal maintenance for SQL SERVER 2005

    >I don't need to do anything else like rebuild procedures or anything else of that sort?

    SQL Server automatically does recompilation of stored procedures for you when needed.
    http://support.microsoft.com/kb/308737

    >This machine is 24/7 and just can't be offline but for a few times during the year.

    I understand. If you use my stored procedure you could do something like this.

    EXECUTE dbo.IndexOptimize
    @Databases = 'USER_DATABASES',
    @FragmentationHigh_LOB = 'INDEX_REORGANIZE_STATISTICS_UPDATE',
    @FragmentationHigh_NonLOB = 'INDEX_REBUILD_ONLINE',
    @FragmentationMedium_LOB = 'INDEX_REORGANIZE_STATISTICS_UPDATE',
    @FragmentationMedium_NonLOB = 'INDEX_REORGANIZE_STATISTICS_UPDATE',
    @FragmentationLow_LOB = 'NOTHING',
    @FragmentationLow_NonLOB = 'NOTHING',
    @FragmentationLevel1 = 5,
    @FragmentationLevel2 = 30,
    @PageCountLevel = 1000

    Here indexes with a fragmentation over 30% will be rebuilt if it can be performed online, otherwise it will be reorganized. Indexes with a fragmentation between 5% and 30% will be reorganized. Indexes with a fragmentation under 5% or a size under a 1000 pages will not be touched. Indexes that are reorganized will also have their statistics updated.

    http://blog.ola.hallengren.com/blog/_archives/2008/1/1/3440068.html

    Ola Hallengren
    http://ola.hallengren.com

Page 1 of 1 (6 items)
Active Topics   My Discussions    Unanswered Posts


© 2000 - 2007 vDerivatives Limited All Rights Reserved.