Sometimes a SQL server database has its recovery mode set to Full mode, and without taking a backup, the log file can keep enlarging until it eats up your HDD, eventually crashing your Database or SQL server and causing problems. To resolve this issue and prevent the log file from expanding, there are three major steps to take:
1- Set the database to Simple Recovery Mode
2- Backup the database
3- Shrink the log file
1- Set the database to Simple Recovery Mode. To set the database to simple mode, right click on the database in management studio, go to properties, a new window will appear, click “options” in the left pane, and set the recovery model to “Simple”.
2- Backup the database. Right click on the Database, go to “Tasks” then “Backup”
A new window will appear, specify you backup location then backup and make sure the backup is successful.
3- Shrink the log file. Right click on your database, > Tasks> Shrink > Files. A new window will appear:
In the new window, change “File Type” to “Log”, and make sure that “Release unused space” is selected under “Shrink Action”. This should fix the issue with oversized log files.