whatfiletypeisthis.com

LDF File

SQL Server Transaction Log (.ldf)

What is a LDF file?

An LDF file is a Microsoft SQL Server transaction log file. It records changes made to a database so SQL Server can recover data after crashes, roll back incomplete transactions, and support features like point-in-time recovery (depending on the recovery model).

Common uses

  • Tracking database changes for recovery
  • Rolling back failed or incomplete transactions
  • Supporting backups and restore operations
  • High-availability/replication scenarios (indirectly)
  • Database consistency and crash recovery

How to open a LDF file

  • SQL Server: You don’t open LDF directly—SQL Server uses it with the database
  • Keep with MDF: Store alongside the matching .mdf file when moving a database
  • Tip: If an app asks for LDF, it usually means you’re attaching/restoring a database

Common problems

  • LDF missing or doesn’t match the MDF
  • Log file grows very large (backup/recovery settings)
  • Can’t attach due to permissions on file path
  • Corruption after crash or disk issues
  • Wrong SQL Server version/compatibility when moving files

History

SQL Server has long used transaction logs to ensure data integrity and recovery. The LDF file remains a critical piece of SQL Server’s durability model, enabling safe writes and consistent restores.