Search SPC

How to Shrink Log File

Sometimes after one or more large transactions, the t-log (transaction log) will become full. In these particular cases you may receive an error message indicating the transaction log is full.
In order to alleviate this issue, you need to find the names of the transaction logs on your system and then shrink them.

To find the names, execute the following statement:

SELECT name
FROM sys.database_files
WHERE TYPE = 1
 
Once you’ve found the names of your transaction logs, use them in the DBCC SHRINKFILE command in order to make them smaller.

DBCC SHRINKFILE(‘AdventureWorksLT2008_Log’);