How to Clear SQL Server Transaction Log

In some cases, the Microsoft SQL Server Transaction Log (.LDF) file becomes very huge. It’s wasting a lot of disk space and causing some problems if you want to back up and restore the database. We can delete the log file and create a new log file with the minimum size.

To delete SQL server transaction log files, follow the steps given below:

  1. Backup the database
  2. Detach the database

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

How to Clear Transaction Log in SQL Server Database

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

How to Clear Transaction Log in SQL Server Database

On Attach Database box, click Add…

How to Clear Transaction Log in SQL Server Database

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

How to Clear Transaction Log in SQL Server Database

Select the log (.ldf) file then click Remove

How to Clear Transaction Log in SQL Server Database

Finally, click OK.

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

How to Clear Transaction Log in SQL Server Database

Have questions? Contact the technology experts at InApp to learn more.

Ready to Build
Something
Extraordinary?

Join 300+ companies who trust us to turn their biggest ideas into market-leading solutions.

Our Global Team
500+ Engineers Worldwide
SOC 2 Certified

Get in Touch with Us

Our Global Team
500+ Engineers Worldwide
SOC 2 Certified

InApp India Office

121 Nila, Technopark Campus
Trivandrum, Kerala 695581
+91 (471) 277 -1800
mktg@inapp.com

InApp USA Office

999 Commercial St. Ste 210 Palo Alto, CA 94303
+1 (650) 283-7833
mktg@inapp.com

InApp Japan Office

6-12 Misuzugaoka, Aoba-ku
Yokohama,225-0016
+81-45-978-0788
mktg@inapp.com
Terms Of Use
© 2000-2026 InApp, All Rights Reserved