Monthly Archives: October 2014
Shrink your SQL Server Log Files (LDFs)
If you just want to shrink your log files, you can use the following code, but make sure to replace DBName with whatever your real database name is.
USE DBName ALTER DATABASE DBName SET RECOVERY SIMPLE DBCC SHRINKFILE( 'DBName_log',1000 ) ALTER DATABASE DBName SET RECOVERY FULL
If by chance your log file isn’t named DBName_log, you can find out what the actual name is by using this bit of code:
USE DBName SELECT name FROM sys.database_files WHERE type_desc = 'LOG'