Monday, 20 January 2014

Types of Physical database files and file groups of SQL Server databases



Database Files:
SQL Server  databases have three types of files:
· Primary data files:
The primary data file is the starting point of the database and points to the Page1 other files in the database.
Every database has one primary data file.
The recommended file name extension for primary data files is .mdf.
· Secondary data files:
Secondary data files are the data files.
A database can have one or more data files.
Secondary data files are other than primary data file.
The recommended file name extension for secondary data files is .ndf.
· Log files
Log files hold all the log information that is used to recover the database.
There must be at least one log file for each database, although there can be
more than one.
 The locations of all the files in a database are recorded in the primary file of the database and in the master database.
The Database Engine uses the file location information from the master database most of the time.

Logical and Physical File Names
They are:
1.logical_file_name2.Physical file name (os_file_name)
Logical_file_name:
The logical_file_name is the name used to refer to the physical file in all Transact-SQL statements.
Physical file name (os_file_name)
The os_file_name is the name of the physical file including the directory path.
SQL Server data and log files can be put on either FAT or NTFS file systems. NTFS is recommended for the security aspects of NTFS.
When multiple instances of SQL Server are run on a single computer, each instance receives a different default directory to hold the files for the databases created in the instance.
EX:


No comments:

Post a Comment