This sections aims to explain in brief the functions of MDF and LDF files in an SQL server database. Other than that, the post also explains basic differences between the two.
MDF and LDF Files in SQL Server Database
All the companies need a system to store/retrieve information. The information can be anything from customer data, to market research, inventory of supplies, accounts information, etc. But, where do companies store that data and how do they retrieve it? Well, they use databases for that purpose.
Most of the companies use MS SQL Server for storing and managing information. That makes Microsoft SQL Server one of the most used programs globally. Within each database, you will find two files namely; MDF and LDF. The two happens to be very crucial in ensuring uninterrupted functioning of the database.
Role in Backing up and Restoring Database
These two are basically file extensions used in Microsoft SQL. These files get automatically created at the time of database creation. They also share the same storage location. The reason why these files are so important is because they happen to be part of backup and recovery process. In simpler words, in case something bad happens to the database, these are the files the administrator will resort to for restoring and recovering the lost/damaged data.
Information Contained in MDF and LDF files
MDF – It stands for Master Database File. It contains all the main information of the database that are part of the server. This extension also points to various other files. It plays a crucial role in information storage. Overall it is very important for safe and secure supervision of data. In case this file gets damaged, an MDF recovery procedure is conducted to recover it. Doing so is important in order to save the data from going missing.
LDF – This file stores information related to transaction logs for main data file. It basically keeps track of what all changes have been made in the database. The information that this file stores ranges from date/time of change, details of the changes made, as well as information related to whoever made the changes. Information related to computer terminals where changes took place is also stored in the logs.
LDF stores changes related to inserts, deletion, updates, addition, etc. Transaction logs kept in the server help in identifying activities related to unauthorized changes as well as where an error is originating. Log information can sometimes come handy in fixing errors, recovering important data, and identifying anomalies.
SQL Operations where LDF Files Play an Important Role
Primarily LDF files are important in three major SQL operations:
- Recovering incomplete transactions when server is started.
- Recovering individual transactions.
- Recovering database in times of failures.
Comparison between MDF and LDF Files
- MDF file is the primary file in SQL server database. The LDF is a supporting file. The latter stores the information related to transaction logs.
- MDF contains database record data. LDF, on the other hand records information related to changes made in the server as well as all the actions performed.
- Unlike MDF, LDF is primarily about three major operations that were mentioned earlier.
- LDF files can go on to consume a lot of storage space depending on the number of changes made in the server as well as the number of transactions that took place. MDF, on the other hand can vary in its file size with the change of the table and record data.
Author Introduction:
Peter Song is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including outlook recovery and PDF recovery software products. For more information, visit www.datanumen.com.
1
If some one wishes expert view about blogging afterward i suggest him/her to visit this web site, Keep up the nice work.