How to Shrink Your Database Transaction Log
If you have noticed that your transaction log on your SQL Server database has grown incredibly large after a long transactional process, you can try this to shrink it back down:
DBCC SHRINKFILE(mydatabase_log, 2)
GO
BACKUP LOG mydatabase WITH TRUNCATE_ONLY
GO
DBCC SHRINKFILE(mydatabase_log, 2)
GO
GO
BACKUP LOG mydatabase WITH TRUNCATE_ONLY
GO
DBCC SHRINKFILE(mydatabase_log, 2)
GO
Of course, you’ll want to replace “mydatabase” with the name of the database you wish to shrink and “mydatabase_log” with the name of the log for that database.