Directory
-
- Directory
- Correct understanding of SQL Server database files
- Create a database
- Resources
Correct understanding of SQL Server database files
The MS SQL Server database file can be divided into the following 2 categories:
Data file (. mdf or. ndf)
Transaction log file (. ldf)
"Data Files" can be divided into: Master data Files (Primary. mdf) and secondary data files (secondary. ndf)
We can view information about database files through the catalog view sys.database_files
--查看数据库文件相关信息select * from sys.database_files
Note: SQL Server is internally identified by a logical name, while storage uses a physical name.
The logical and physical names are consistent by default.
Create a database
There are 2 ways to create a SQL Server database:
- Create with Management Studio graphics
- Created by the CREATE DATABASE statement
Note:the user database for SQL Server is created based on the system database model, so modifying the model database may affect the creation of the user database .
In addition, when creating a database, it is recommended that you modify the parameters for automatically growing data files.
Resources
1. Microsoft SQL Server Internals-Chapter 3
Update by Hyperwang at 2016/05/25
Learn with me Microsoft SQL Server Internals (3.2)