Truncate Log

  • It's not possible. All data modifications are logged and the log entries cannot be discarded from the log until the transaction has committed and the data pages changed by that modification have been written to disk.

    Some operations (truncate table) are minimally logged, meaning that only a small amount is written to the log, as compared with fully logged operations (like delete) where the entire change is written to the transaction log in case it's necessary for rollback/database recovery.

    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
  • Is it just me or was some of the advice in this topic very very risky?

  • thanks..:)

  • Shark Energy (9/19/2008)


    Is it just me or was some of the advice in this topic very very risky?

    It's not just you. Some were more than 'very risky'

    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
  • Just perform the Shrink File using SQL server 2005 Managment studio. and select option "Release unused Space"

  • Issue DBCC SHRINKFILE ('Hr_database_log',TRUNCATEONLY)

  • 🙂 Thank You.

  • Hi

    U can do this by the following script

    DBCC SHRINKDATABASE('DATABASENAME',TRUNCATEONLY)

  • See Paul S. Randal's article

    It gave me better understanding of the transaction log. Seeing him and Kimberly Trip is a trip! - pun totally intended. They are great presenters; and, really know MSSQL.


    {Francisco}

  • barsuk (10/4/2005)


    something like that:

    Backup LOG Hr_database WITH NO_LOG

    GO

    DBCC SHRINKFILE ('Hr_database_log',TRUNCATEONLY)

    GO

    Brilliant, thanks for the help. This solution worked for me.

Viewing 10 posts - 46 through 54 (of 54 total)

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