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
- Log into Microsoft SQL Server Management Studio
- Right click on your database.
- Select Properties.
- Click on Options.
- Change the recovery model to Simple.
- Click OK.
- Right click on the database.
- Select Tasks > Shrink > Database.
- Click OK.
- Right click on the database.
- Select Properties.
- Click on Options.
- Change the recovery model to Full.
You are recommended to take full back up right before/after above query.
Senior Engineer Jessie
Comments