In the previously published blog we have discussed about the Truncate, Delete and Drop Statements in SQL Server now in this blog we will discuss about SQL Server MDF and LDF Files. The Microsoft SQL Server is a Relational Database Management System. In SQL Server MDF and LDF are two types of file. A person experienced with Microsoft SQL Server is already aware of the terms MDF and LDF.
These file extensions represent the SQL Server Primary Data files (MDF) and Log data files (LDF).
SQL Server MDF Files
In the SQL Server Primary Data Files are the basic data files which are related to the database for the storing and supervision of the information.
MDF file in SQL Server are associated with other related files of the same database. That is why every database is represented by Primary Data File. Therefore, all the triggers, stored procedures, views, tables etc. related to the same database are also stored in the MDF file. On the other hand, we can say that the MDF file is the key element of database administration and data substances on the server. These primary database files are denoted as .mdf, i.e. Master Database File.
SQL Server LDF Files
The LDF files in SQL Server are very useful for the database recovery purpose in future. The limitations and size of LDF file can be defined at the time of database designing. Every database has at least one log data file, but it is also possible that there may be several data log files for the same database.
SQL Server LDF files store the transaction information (insert, update, delete etc.) Log files helps to track the changes in the database and helps in tracking the source of problems when any threat occurs. Log files are also used for the database forensics purpose as they log the information regarding each activity conducted on the associated database. The extension of log data file is .ldf.
Importance of MDF and LDF Files in SQL Server
Generally, SQL Server contains two types of data file; Primary data file and secondary data file. The most important aspect of these files is that it can be used as backup files. In SQL Server database sometimes errors occurs due to improper/unexpected shutdown of computer system, virus attack and many other reasons that create severe problem related to database access.
Corruption Reasons of SQL Server MDF and LDF Files
MDF and LDF files may corrupt due to miscellaneous reasons. Some of them are like:
- Storage Size may prove to be an important aspect for turning MDF and LDF files as corrupted and damaged.
- Suspicious Mode of Computer is also an important reason in the corruption of database files.
- Modification of Database During DROP Operation may also be a reason of database file corruption.
- Hardware Issue is an important reason behind the data corruption. Thus, an administrator always keep a check on the hardware regularly.
- Viruses or Bug Programs are also responsible for the MDF and LDF corruption on SQL Server database.
In this article, we discussed about the SQL Server MDF and LDF files, its importance and reasons of corruption.