Microsoft:SQL:Shrink transaction log
Shrink transaction log
To shrink the transaction log of a database do the following:
- Change the recovery model to Simple.
- Run the following SQL command/query to shrink the file to 2MB: DBCC SHRINKFILE(database_name_log, 2)
- If the target size is not reached, proceed with the following step.
- Run the following SQL command/query: BACKUP LOG database_name WITH TRUNKCATE_ONLY
- Re-run the DBCC SHRINKFILE command.
- Change the recovery model back to Full.