How to shrink SQL transaction log

 

Log records that are not managed correctly will eventually fill up the disk, causing no more modifications to the database. Transaction log growth can occur for a few different reasons. Long running transactions, incorrect recovery model configuration and lack of log backups can grow the log.

Log truncation frees up space in the log file so the transaction log can reuse it. Unless there is some kind of unexpected delay, log truncation will occur automatically after a checkpoint (if the database is in SIMPLE recovery model) or after a log backup (if the database is in FULL or BULK-LOGGED recovery model).

Shrink the log in SQL Server Management Studio

1. Log into SQL Server Management Studio.

2. Right click the desired database.

3. Choose Tasks > Shrink > Files:

1.png

 

4. On the Shrink File window, change the File Type to Log. You can also choose to either release unused space, reorganize pages before releasing unused space, or empty file by migrating the data to other files in the same filegroup:

2.png