What Is Mdf SQL?
The SQL Server database application stores each piece of important data in an MDF file. The MDF file contains tables, stored procedures and user account information. The MDF file is "attached" to the SQL Server, which means the server has the ability to add, edit and delete records. MDF files are also seen in backup archives. The MDF file can be used to recover information after the SQL Server fails from a hard drive crash or software corruption.
-
Function
-
The SQL MDF file contains tables, stored procedures and user accounts. The MDF file is "attached" to the database. The MDF file is automatically created when the administrator creates a new database. The file continues to grow each time a user creates a new record in the tables. The user tables are the main storage objects in the MDF file. These objects can hold millions of records for the company.
Identification
-
The MDF file is placed in the same directory where SQL Server is installed. A special "data" directory is created, so administrators can quickly find each MDF file for each database. The MDF file is typically named using the same name as the database, but administrators can label it any recognizable name. MDF files have accompanying LDF files. An LDF file is a transaction log. Each command executed on the server is saved in the LDF file.
-
Size
-
MDF files can grow to several megabytes. Databases with millions of rows can even grow into gigabytes of information. For this reason, database administrators who maintain large, enterprise servers should ensure that the hard drive has enough storage space to hold the growing MDF file. This is especially important when the hard drive houses several databases for the company. With each MDF file growing to several gigabytes, hard drive space is quickly consumed.
Considerations
-
The database administrator can use the MDF file as a backup. The MDF file is copied to an external media device such as an external hard drive, USB flash drive, CD or DVD. For extremely large MDF files, a tape drive is used. However, a tape drive does not restore data as quickly as a DVD or CD drive. Creating a copy of the MDF file saves from data loss.
Warning
-
MDF files stored on a local hard drive only may suffer from corruption. The corruption of an MDF file can lead to complete data loss, and the company can lose all of its important data. For this reason, database administrators should back up and store a copy of the MDF file in a safe, secure location.
-
References
- Photo Credit search and magnifier buttons. (with clipping path) image by Andrey Zyk from Fotolia.com