Knowledgebase: MSSQL Server
Shrinking Truncate SQL SERVER Log File
Posted by Sean Syed on 21 February 2013 07:22 PM

Following code always shrinks the Truncated Log File to minimum size possible. Use one of the following two procedures.

PROCEDURE 1

USE DatabaseName
GO
DBCC SHRINKFILE(<TransactionLogName>, 1)
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLogName>, 1)
GO

 

PROCEDURE 2

  1. Log into Microsoft SQL Server Management Studio
  2. Right click on your database.
  3. Select Properties.
  4. Click on Options.
  5. Change the recovery model to Simple.
  6. Click OK.
  7. Right click on the database.
  8. Select Tasks > Shrink > Database.
  9. Click OK.
  10. Right click on the database.
  11. Select Properties.
  12. Click on Options.
  13. Change the recovery model to Full.

You are recommended to take full back up right before/after above query.

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).