An SQL Server database contains primary data files, secondary data files (optional), and transaction log files.

The primary and secondary datafiles contain tables, database objects, schema, and data.

The file extension of the primary database file is *.mdf, and the file extension of the secondary data file is *.ndf.

The transaction log files store all the changes made by the transactions (insert, update, and delete). If the SQL Server restarts unexpectedly or crashes, the database engine rolls the incomplete transaction back before the point of failure using the Transaction log file.

The extension of the transaction log file is *.ldf. You might want to refer to this article to understand the Transaction Log Files architecture.

In this article, I am going to explain how we can manage the database files (MDF files) in SQL Server 2019.

The article will cover the following points:

  1. View the database file details using DMVs and SQL Server Management Studio.
  2. Attach and detach the User databases MDF Files.
  3. Attach and detach the system databases MDF Files.

#mdf file #sql server 2019 #ssms #t-sql #sql

Manage MDF Files in SQL Server 2019
1.15 GEEK