Tuesday, December 8, 2009

Physical Database Files and Filegroups

SQL Server 2000 databases have three types of files:

  • Primary data files

    The primary data file is the starting point of the database and points to the 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 comprise all of the data files other than the primary data file. Some databases may not have any secondary data files, while others have multiple secondary data files. The recommended file name extension for secondary data files is .ndf.

  • Log files

    Log files hold all of the log information used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf.

SQL Server 2000 does not enforce the .mdf, .ndf, and .ldf file name extensions, but these extensions are recommended to help identify the use of the file.

In SQL Server 2000, the locations of all the files in a database are recorded in both the master database and the primary file for the database. Most of the time the database engine uses the file location information from the master database. For some operations, however, the database engine uses the file location information from the primary file to initialize the file location entries in the master database:

  • When attaching a database using the sp_attach_db system stored procedure.

  • When upgrading from SQL Server version 7.0 to SQL Server 2000.

  • When restoring the master database.

SQL Server 2000 files have two names:

  • logical_file_name is a name used to refer to the file in all Transact-SQL statements.

    The logical file name must conform to the rules for SQL Server identifiers and must be unique to the database.

  • os_file_name is the name of the physical file.

    It must follow the rules for Microsoft Windows NT® or Microsoft Windows Me, and Microsoft Windows 98 file names.

 

About

Site Info

Information Source

SQL Server Copyright © 2009 Community is Developed by Dot Net Developer WebSite

/* tracking code by yahoo login */