transaction log size reduction

  • Does backup of transaction log reduce the log file size or it is DBCC SHRINKFILE really make the size small?

    I know it is not good practice to shrink log, but we have special case that need to do that to save space. For example we have some archived databases and set to readonly, and simple recovery mode,

    we don't need those big log file there, so I was able to shrink the log size to a smaller one.

    But I remember somewhere I read only backup transaction log reduces the size, not shrink , or maybe I didn't remmember it correctly?

    Thanks

  • Log backups don't change the size of the file, they just mark the space inside as reusable.

    Please read through this - Managing Transaction Logs[/url]

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • And this one too.[/url]

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • If the database is in Full recovery model then you can able to take the log backup.

  • Thanks all, so I think I remember it wrong,

    What is correct should be:

    Backup transaction log is only mark part of transaction log file active, so it could be reused, and it will not make the size small.

    Shrink will actually reduce the size of the log file.

  • ganasulochana (3/28/2013)


    If the database is in Full recovery model then you can able to take the log backup.

    for simple recovery mode, when it will do the checkpoints?

  • sqlfriends (3/28/2013)


    ganasulochana (3/28/2013)


    If the database is in Full recovery model then you can able to take the log backup.

    for simple recovery mode, when it will do the checkpoints?

    Checkpoint runs on a regular basis in databases in all recovery models. Recovery model doesn't change how often checkpoint runs, it depends on data changes and the recovery interval setting.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (3/28/2013)


    sqlfriends (3/28/2013)


    ganasulochana (3/28/2013)


    If the database is in Full recovery model then you can able to take the log backup.

    for simple recovery mode, when it will do the checkpoints?

    Checkpoint runs on a regular basis in databases in all recovery models. Recovery model doesn't change how often checkpoint runs, it depends on data changes and the recovery interval setting.

    Thanks much, is there a way that I can find out what it the 'recovery interval setting'?

  • Sure, look it up on the server properties window, in sys.configurations or sp_configure.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • If you haven't specified it during the initial install, it's set to 0 by default, meaning that it happens automatically (running approximately every 1 minutes for active DB's)

    Reference MSDN here

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • MyDoggieJessie (3/28/2013)


    If you haven't specified it during the initial install, it's set to 0 by default, meaning that it happens automatically (running approximately every 1 minutes for active DB's)

    Reference MSDN here

    Thanks, that is what I found, it is 0.

    So the checkpoints commits approximately every one minute, that is quite frequent than I think.

  • You said this database is Read Only?

    If so, there should be no reason why you can't set it to Simple Recovery Model, then Shrink the Transaction Log file down to almost nothing, and I don't think it should ever grow again.

Viewing 12 posts - 1 through 11 (of 11 total)

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