Log truncation

  • i tried to truncate log file thgough dbcc comaand bt it is still not releasing space why??

    pls help frns

  • Possibly because it's full. Shrinkfile just tries to release unused space. If there isn't any unused space, there's nothing to release.

    What does DBCC SQLPERF(Logspace) return for this DB?

    What is the value of log_reuse_wait_desc in sys.databases for this DB?

    What's the recovery model of this DB?

    If the recovery model is anything other than Simple, how often are you doing log backups?

    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 recovery model is full try backing up your transaction log then run your dbcc command to shrink the transaction log to the size you choose. That should do it. I've been in that situation several times with boxes I've inherited.

    lavigne (wcucomputernerd)

    http://www.sqlfornewbies.com

  • See this link on log truncation and shrinking.

    SQL BAK Explorer - read SQL Server backup file details without SQL Server.
    Supports backup files created with SQL Server 2005 up to SQL Server 2017.

  • Do you have transaction log backup ? if not then schedule it depending on your environment.

    Try to put the DB into single user mode , Truncate the log and the shrink it, before shrinking it check how much empty space is available? it will shrink only if there is any empty space available.

    If still you are not able shrink then , would like to know if you have setup any replication. Because we have seen due to this tlog shrinking is impacted.

    Let us know?

    "More Green More Oxygen !! Plant a tree today"

  • Truncate log command will not work on SQL 2008.

    I tried this option and worked for me DBCC Shrinkfile(logfile number,space in mb,truncateonly)

  • Rajesh M S (7/8/2010)


    I tried this option and worked for me DBCC Shrinkfile(logfile number,space in mb,truncateonly)

    The truncateonly option is ignored on log files, it only applies to data files. That statement will only work if there's free space in the transaction log

    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
  • Hi,

    If you don't want the transaction log, Then you can use by the following query

    backup log databasename with truncate_only

    In these query will truncate the log space. you can try this..

    With thanks & regards

    Balaji.G

  • balaji.ganga (7/12/2010)


    backup log databasename with truncate_only

    That does not work in SQL 2008.

    Msg 155, Level 15, State 1, Line 1

    'truncate_only' is not a recognized BACKUP option.

    If you don't want point-in-time recovery, set the database to simple recovery, and leave the log alone. If you need it in full (or bulk-logged) for recovery purposes, back the log up on a regular basis.

    Take a look through this article - http://qa.sqlservercentral.com/articles/64582/

    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

Viewing 9 posts - 1 through 8 (of 8 total)

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