At a minimum, a SQL Server database has two operating system files; the data file, and the log file.
The data file holds the actual data in the database, as well as objects such as tables, indexes, stored procedures, and views. The log file contains the information that is required to recover all transactions in the database.
When you create a database using the default options, both of these files are created. These files are created in the primary filegroup. This filegroup contains the primary data file and any secondary files that are not put into other filegroups. So the primary filegroup is the default filegroup (unless it’s changed by using the ALTER DATABASE
statement).
When you create multiple data files, you also have the option of grouping them into a user-defined filegroup. This allows you to group files logically into their own filegroup that you created. This filegroup will then exist in addition to the primary filegroup. Database objects will remain will remain within the primary filegroup.
This article demonstrates how to create a user-defined filegroup and add some data files to it.
Continue reading →