Shrinking Truncate SQL SERVER Log File Print

  • 0

Shrinking Truncate SQL SERVER Log File

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.


Was this answer helpful?

« Back