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

前端 未结 4 1412
难免孤独
难免孤独 2021-01-05 05:43

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

4条回答
  •  长发绾君心
    2021-01-05 06:02

    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.

提交回复
热议问题