Delete SQL Server Database Transaction Log File

In some case, the Microsoft SQL Server Database Transaction Log (.LDF) file becomes very huge.
It’s wasting lot of disk space and causing some problems if you want to backup and restore the database.
We can delete log file and create a new log file with the minimum size.
To delete log files, follow the Steps given below:

  1. Backup the database
  2. Detach the database

Right-click on the database => Tasks => Detach

task-detach

3. Delete or rename the big log file (path:C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA)

4. Attach the database again
Right-click Databases => Attach

database-attach

On Attach Database box, click Add…

attach-add

Browser to the database (.mdf) file then click OK

attach-add-2

Select the log (.ldf) file then click Remove

log-remove

Finally click OK.

You can see the new log file with the minimum size.

new log file



Author: InApp
We are a custom software development company offering Testing Services, Application Development, Mobility Solutions & more. Customers: Startups - Fortune 500

3 Comments

Leave a Reply

2 × two =