SQL Server database File types
The database is stored on disk as a file, consisting of data files and transaction log files, and a database should contain at least one data file and one transaction log file.
The database is created on the NTFS partition of a physical medium (such as a hard disk) or on one or more files of a FAT partition, which pre-allocates the physical storage space that will be used by the data and transaction logs. The file that stores the data is called a data file, and the data file contains data and objects, such as tables and indexes. The file that stores the transaction log is called a transaction log file (also known as a log file). When creating a new database, you simply create a "shell," you must create an object (such as a table) in this "shell" before you can use the database.
The SQLSERVER2008 database has the following four types of files
• Master data file: The master data file contains the startup information of the database, points to other files in the database, each database has a master data file, and the file name extension of the master data file is. mdf.
• Secondary (secondary) data files: All other data files except the master data file are secondary data files, some databases may not contain any secondary data files, and some databases contain multiple secondary data files, and the file name extension for secondary data files is. ndf.
• Transaction log file: Contains information that restores all transaction logs for the database. Each database must have at least one transaction log file and, of course, more than one, and the recommended file name extension for the transaction log file is. ldf.
• File Stream (Filestream): Enables SQL Server-based applications to store unstructured data, such as documents, pictures, audio, etc., in a file system, which mainly integrates the SQL Server database engine with the new technology file System (NTFS). It stores data primarily in the varbinary (max) data type.
SQL Server file types