Shrinking SQL Server 2005 log files
There are different ways of doing this, you can try to do this through the SQL Server management studio but never really seems to work…
Best way of doing it that I’ve found is using the following script, this will shrink the log file to 1MB, the number of megabytes can be changed within the script. This script backups the database before it shrinks the file, so you can alway roll back if required.
USE DATABASENAME
GO
BACKUP LOG DATABASENAME TO DISK = ‘C:\DATABASENAME.bak’ WITH TRUNCATE_ONLY
DBCC SHRINKFILE(‘DATABASELOGNAME’, 1)
GO
DATABASENAME = the name of the database
DATABASELOGNAME = the logical name of the log file. This can be found if you right click on the database within the management studio, select Properties and then click on the ‘Files’ tab on the left hand navigation.