Why do we need the LDF files along with MDF files?

Oscar Mederos picture Oscar Mederos · May 10, 2011 · Viewed 27.4k times · Source

What would happen if I delete the .ldf file that is in the same folder that my .mdf file?

Answer

Dustin Laine picture Dustin Laine · May 10, 2011

The LDF file is the transaction log and is required for all SQL server configurations. Depending on the recovery mode, will determine how it is used. However all queries basically get stored here until successfully committed to the database (MDF).

You will not be able to delete it while SQL server service is running. You can detach the database, delete the log file (LDF) and reattach the data file (MDF). However it will just create a new log file. You really should not need to delete it. If it is getting too large you will need to manage it, typically through the backup process.