Difference Between Similar Terms and Objects

Difference Between LDF and MDF


Companies use databases to store, examine, and retrieve valuable information like customers, market research, accounts, market trends, inventory of supplies, employees, and other vital data to a company and its everyday operations. Most companies use Microsoft SQL for creating databases and storing information making it the most used program and application in this function. Within the MSSQL files, MDF and LDF can be found and used.

Both LDF and MDF are files extensions used in the Microsoft SQL Server. These file extensions come in tandem and are created automatically when a new database is created in the program. Both files are also located in the same location for easy reference. But one of the most important functions of these files is that they are components of the backup file (with the file extension .bak) used in the program.

The extension file .MDF stands for “Master Database File.” This file contains all the startup information for the database to run and tracks all the databases on the SQL server. It also points to the other files in the database. This file is also a key file in storing information that is very important in admittance and supervision of data content on the server.

Meanwhile, LDF is the file extension for the server transaction log for the main data file. It saves the database information in addition to keeping a record of all the actions and changes made on the information on the server. This includes; date, time, details of all changes, user information regarding who made the changes. In addition, the log also features the computer terminal where the changes were made.

The changes that an .LDF file often records frequently include; file deletion, inserts, alerts, additions, and updates. Usually, the .LDF is the companion file to .MDF when a new database or when a backup file is created. The server transaction log helps in tracking unauthorized changes or track down the origin of an error. The information made on the log can help point out the anomaly, recover important and necessary data, and help in fixing access as well as the error.

LDF files are important in three operations in the SQL operations. These include: recovery of individual transactions, recovery of all incomplete transactions at the time when the server is started, and recovering the database when there is failure. In the first operation, a rollback statement is issued by the application, and the .LDf file is used to reverse that operation. In cases of servers detecting an error or errors, the LDF file will back up the incomplete transaction.

The second operation requires a failed SQL server. The LDF file is used to move back to a recovery point or a backup file wherein the database is fully functioning. The third operation requires a database failure. When this scenario happens, the LDF files are used to restore the database before the event of failure. In this operation, information and all data are safe and not corrupted.

1.MDF is the primary data file for MSSQL. The LDF, on the other hand, is a supporting file and is characterized as a server transaction log file.
2.MDF contains all the vital and necessary information in databases while the LDF contains all the actions which include transactions and changes made in the MDF file.
3.LDF is concerned with three operations while MDF is not.
4.The LDF file size can take up a lot of space due to the numerous changes and the information details ascribed to the changes while the MDF file can maintain or a change in file size depending on the actual changes made to the file itself.

Sharing is caring!

Search DifferenceBetween.net :

Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.

Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.

See more about :
Protected by Copyscape Plagiarism Finder