Posted  by 

Sql Server 2008 R2 Dev Path C:program Files

-->

APPLIES TO: SQL Server Azure SQL Database Azure Synapse Analytics (SQL DW) Parallel Data Warehouse

This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Path: C: Program Files Microsoft SQL Server MSSQL10.MSSQLSERVER MSSQL DATA; C: Program Files Microsoft SQL Server MSSQL10.MSSQLSERVER MSSQL DATA; FileName: my.MDF; my1.LDF; What would be the sql script to move these files to a new location: D: DATA. Database is live so I would need to close existing connections. SQL Server 2008 SELECT Concatenation and LEFT specific character I have the following code concatenating a series of text to one field. Each hit in this query has data following a ^. I only want to display every LEFT of the ^ and not the ^ itself. Is this possible? Here is my code. SELECT Cast(Cast(((SELECT. FR.

At a minimum, every SQL Server database has two operating system files: a data file and a log file. Data files contain data and objects such as tables, indexes, stored procedures, and views. Log files contain the information that is required to recover all transactions in the database. Data files can be grouped together in filegroups for allocation and administration purposes.

Database Files

SQL Server databases have three types of files, as shown in the following table.

FileDescription
PrimaryThe primary data file contains the startup information for the database and points to the other files in the database. User data and objects can be stored in this file or in secondary data files. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.
SecondarySecondary data files are optional, are user-defined, and store user data. Secondary files can be used to spread data across multiple disks by putting each file on a different disk drive. Additionally, if a database exceeds the maximum size for a single Windows file, you can use secondary data files so the database can continue to grow.
The recommended file name extension for secondary data files is .ndf.
Transaction LogThe transaction log files hold the log information that is used to recover the database. There must be at least one log file for each database. The recommended file name extension for transaction logs is .ldf.

For example, a simple database named Sales can be created that includes one primary file that contains all data and objects and a log file that contains the transaction log information. Alternatively, a more complex database named Orders can be created that includes one primary file and five secondary files. The data and objects within the database spread across all six files, and the four log files contain the transaction log information.

By default, the data and transaction logs are put on the same drive and path. This is done to handle single-disk systems. However, this may not be optimal for production environments. We recommend that you put data and log files on separate disks.

Logical and Physical File Names

SQL Server files have two file name types: Vst drum download free.

logical_file_name: The logical_file_name is the name used to refer to the physical file in all Transact-SQL statements. The logical file name must comply with the rules for SQL Server identifiers and must be unique among logical file names in the database. This is set by the NAME argument in ALTER DATABASE. For more information, see ALTER DATABASE File and Filegroup Options (Transact-SQL).

os_file_name: The os_file_name is the name of the physical file including the directory path. It must follow the rules for the operating system file names. This is set by the FILENAME argument in ALTER DATABASE. For more information, see ALTER DATABASE File and Filegroup Options (Transact-SQL).

Important

SQL Server data and log files can be put on either FAT or NTFS file systems. On Windows systems, we recommend using the NTFS file system because the security aspects of NTFS.

Warning

Read/write data filegroups and log files are not supported on an NTFS compressed file system. Only read-only databases and read-only secondary filegroups are allowed to be put on an NTFS compressed file system.For space savings, it is highly recommended to use data compression instead of file system compression.

When multiple instances of SQL Server are running on a single computer, each instance receives a different default directory to hold the files for the databases created in the instance. For more information, see File Locations for Default and Named Instances of SQL Server.

Data File Pages

Pages in a SQL Server data file are numbered sequentially, starting with zero (0) for the first page in the file. Each file in a database has a unique file ID number. To uniquely identify a page in a database, both the file ID and the page number are required. The following example shows the page numbers in a database that has a 4-MB primary data file and a 1-MB secondary data file.

The first page in each file is a file header page that contains information about the attributes of the file. Several of the other pages at the start of the file also contain system information, such as allocation maps. One of the system pages stored in both the primary data file and the first log file is a database boot page that contains information about the attributes of the database. For more information about pages and page types, see Pages and Extents Architecture Guide.

File Size

SQL Server files can grow automatically from their originally specified size. When you define a file, you can specify a specific growth increment. Every time the file is filled, it increases its size by the growth increment. If there are multiple files in a filegroup, they will not autogrow until all the files are full. Growth then occurs in a round-robin fashion using proportional fill.

Each file can also have a maximum size specified. If a maximum size is not specified, the file can continue to grow until it has used all available space on the disk. This feature is especially useful when SQL Server is used as a database embedded in an application where the user does not have convenient access to a system administrator. The user can let the files autogrow as required to reduce the administrative burden of monitoring free space in the database and manually allocating additional space.

If Instant File Initialization (IFI) is enabled for SQL Server, there is minimal overhead when allocating new space for data files.

For more information on transaction log file management, see Manage the size of the transaction log file.

Database Snapshot Files

The form of file that is used by a database snapshot to store its copy-on-write data depends on whether the snapshot is created by a user or used internally:

  • A database snapshot that is created by a user stores its data in one or more sparse files. Sparse file technology is a feature of the NTFS file system. At first, a sparse file contains no user data, and disk space for user data has not been allocated to the sparse file. For general information about the use of sparse files in database snapshots and how database snapshots grow, see View the Size of the Sparse File of a Database Snapshot.
  • Database snapshots are used internally by certain DBCC commands. These commands include DBCC CHECKDB, DBCC CHECKTABLE, DBCC CHECKALLOC, and DBCC CHECKFILEGROUP. An internal database snapshot uses sparse alternate data streams of the original database files. Like sparse files, alternate data streams are a feature of the NTFS file system. The use of sparse alternate data streams allows for multiple data allocations to be associated with a single file or folder without affecting the file size or volume statistics.

Filegroups

Every database has a primary filegroup. This filegroup contains the primary data file and any secondary files that are not put into other filegroups. User-defined filegroups can be created to group data files together for administrative, data allocation, and placement purposes.

For example, three files, Data1.ndf, Data2.ndf, and Data3.ndf, can be created on three disk drives, respectively, and assigned to the filegroup fgroup1. A table can then be created specifically on the filegroup fgroup1. Queries for data from the table will be spread across the three disks; this will improve performance. The same performance improvement can be accomplished by using a single file created on a RAID (redundant array of independent disks) stripe set. However, files and filegroups let you easily add new files to new disks.

All data files are stored in the filegroups listed in the following table.

FilegroupDescription
PrimaryThe filegroup that contains the primary file. All system tables are allocated to the primary filegroup.
Memory Optimized DataA memory-optimized filegroup is based on filestream filegroup
Filestream
User-definedAny filegroup that is specifically created by the user when the user first creates or later modifies the database.

Default (Primary) Filegroup

When objects are created in the database without specifying which filegroup they belong to, they are assigned to the default filegroup. At any time, exactly one filegroup is designated as the default filegroup. The files in the default filegroup must be large enough to hold any new objects not allocated to other filegroups.

The PRIMARY filegroup is the default filegroup unless it is changed by using the ALTER DATABASE statement. Allocation for the system objects and tables remains within the PRIMARY filegroup, not the new default filegroup.

Memory Optimized Data Filegroup

For more information on memory-optimized filegroups, see Memory Optimized Filegroup.

Filestream Filegroup

For more information on filestream filegroups, see FILESTREAM and Create a FILESTREAM-Enabled Database.

File and Filegroup Example

The following example creates a database on an instance of SQL Server. The database has a primary data file, a user-defined filegroup, and a log file. The primary data file is in the primary filegroup and the user-defined filegroup has two secondary data files. An ALTER DATABASE statement makes the user-defined filegroup the default. A table is then created specifying the user-defined filegroup. (This example uses a generic path c:Program FilesMicrosoft SQL ServerMSSQL.1 to avoid specifying a version of SQL Server.)

The following illustration summarizes the results of the previous example (except for the Filestream data).

File and Filegroup Fill Strategy

Filegroups use a proportional fill strategy across all the files within each filegroup. As data is written to the filegroup, the SQL Server Database Engine writes an amount proportional to the free space in the file to each file within the filegroup, instead of writing all the data to the first file until full. It then writes to the next file. For example, if file f1 has 100 MB free and file f2 has 200 MB free, one extent is allocated from file f1, two extents from file f2, and so on. In this way, both files become full at about the same time, and simple striping is achieved.

As soon as all the files in a filegroup are full, the SQL Server Database Engine automatically expands one file at a time in a round-robin manner to allow for more data, provided that the database is set to grow automatically. For example, a filegroup is made up of three files, all set to automatically grow. When space in all the files in the filegroup is exhausted, only the first file is expanded. When the first file is full and no more data can be written to the filegroup, the second file is expanded. When the second file is full and no more data can be written to the filegroup, the third file is expanded. If the third file becomes full and no more data can be written to the filegroup, the first file is expanded again, and so on.

Rules for designing Files and Filegroups

The following rules pertain to files and filegroups:

  • A file or filegroup cannot be used by more than one database. For example, file sales.mdf and sales.ndf, which contain data and objects from the sales database, cannot be used by any other database.
  • A file can be a member of only one filegroup.
  • Transaction log files are never part of any filegroups.

Recommendations

Following are some general recommendations when you are working with files and filegroups:

  • Most databases will work well with a single data file and a single transaction log file.
  • If you use multiple data files, create a second filegroup for the additional file and make that filegroup the default filegroup. In this way, the primary file will contain only system tables and objects.
  • To maximize performance, create files or filegroups on different available disks as possible. Put objects that compete heavily for space in different filegroups.
  • Use filegroups to enable placement of objects on specific physical disks.
  • Put different tables used in the same join queries in different filegroups. This will improve performance, because of parallel disk I/O searching for joined data.
  • Put heavily accessed tables and the nonclustered indexes that belong to those tables on different filegroups. This will improve performance, because of parallel I/O if the files are located on different physical disks.
  • Do not put the transaction log file(s) on the same physical disk that has the other files and filegroups.

For more information on transaction log file management recommendations, see Manage the size of the transaction log file.

Related Content

CREATE DATABASE (SQL Server Transact-SQL)
ALTER DATABASE File and Filegroup Options (Transact-SQL)
Database Detach and Attach (SQL Server)
SQL Server Transaction Log Architecture and Management Guide
Pages and Extents Architecture Guide
Manage the size of the transaction log file

-->

APPLIES TO: SQL Server (Windows only) Azure SQL Database Azure Synapse Analytics (SQL DW) Parallel Data Warehouse

An installation of SQL Server consists of one or more separate instances. An instance, whether default or named, has its own set of program and data files, as well as a set of common files shared between all instances of SQL Server on the computer.

For an instance of SQL Server that includes the Database Engine, Analysis Services, and Reporting Services, each component has a full set of data and executable files, and common files shared by all components.

To isolate install locations for each component, unique instance IDs are generated for each component within a given instance of SQL Server.

Important

Program files and data files cannot be installed on a removable disk drive, cannot be installed on a file system that uses compression, cannot be installed to a directory where system files are located, and cannot be installed on shared drives on a failover cluster instance.

You might need to configure scanning software, such as antivirus and antispyware applications, to exclude SQL Server folders and file types. Review this support article for more information: Antivirus software on computers running SQL Server.

System databases (master, model, MSDB, and tempdb), and Database Engine user databases can be installed with Server Message Block (SMB) file server as a storage option. This applies to both SQL Server stand-alone and SQL Server failover cluster installations (FCI). For more information, see Install SQL Server with SMB Fileshare as a Storage Option.

Do not delete any of the following directories or their contents: Binn, Data, Ftdata, HTML, or 1033. You can delete other directories, if necessary; however, you might not be able to retrieve any lost functionality or data without uninstalling and then reinstalling SQL Server. Do not delete or modify any of the .htm files in the HTML directory. They are required for SQL Server tools to function properly.

Shared Files for All Instances of SQL Server

Common files used by all instances on a single computer are installed in the folder <drive>:Program FilesMicrosoft SQL Servernnn. <drive> is the drive letter where components are installed. The default is usually drive C. nnn identifies the version. The following table identifies versions for the paths. {nn} is the version value used in the instance ID, and registry path.

Version*nnn*{nn}
SQL Server 2019 (15.x)15015
SQL Server 2017 (14.x)14014
SQL Server 2016 (13.x)13013
SQL Server 2014 (12.x)12012
SQL Server 2012 (11.x)11011

File Locations and Registry Mapping

Scenarist bd 5 7 serial key. During SQL Server Setup, an instance ID is generated for each server component. The server components in this SQL Server release are the Database Engine, Analysis Services, and Reporting Services.

The default instance ID is constructed by using the following format:

  • MSSQL for the Database Engine, followed by the major version number, followed by an underscore and the minor version when applicable, and a period, followed by the instance name.

  • MSAS for Analysis Services, followed by the major version number, followed by an underscore and the minor version when applicable, and a period, followed by the instance name.

  • MSRS for Reporting Services, followed by the major version number, followed by an underscore and the minor version when applicable, and a period, followed by the instance name.

Examples of default instance IDs in this release of SQL Server are as follows:

  • MSSQL{nn}.MSSQLSERVER for a default instance of SQL Server 2019 (15.x).

  • MSAS{nn}.MSSQLSERVER for a default instance of SQL Server Analysis Services.

  • MSSQL{nn}.MyInstance for a named instance of SQL Server 2019 (15.x) named 'MyInstance.'

Sql Server 2008 R2 Dev Path C:program Files Pdf

The directory structure for a SQL Server 2019 (15.x) named instance that includes the Database Engine and Analysis Services, named 'MyInstance', and installed to the default directories would be as follows:

  • C:Program FilesMicrosoft SQL ServerMSSQL{nn}.MyInstance

  • C:Program FilesMicrosoft SQL ServerMSAS{nn}.MyInstance

You can specify any value for the instance ID, but avoid special characters and reserved keywords.

You can specify a non-default instance ID during SQL Server Setup. Instead of {Program Files}MicrosoftSQL Server, a <custom path>MicrosoftSQL Server is used if the user chooses to change the default installation directory. Note that instance IDs that begin with an underscore (_) or that contain the number sign (#) or the dollar sign ($) are not supported.

Note

Integration Services and client components are not instance aware and, therefore are not assigned an instance ID. By default, non-instance-aware components are installed to a single directory: <drive>:Program FilesMicrosoft SQL Servernnn. Changing the installation path for one shared component also changes it for the other shared components. Subsequent installations install non-instance-aware components to the same directory as the original installation.

SQL Server Analysis Services is the only SQL Server component that supports instance renaming after installation. If an instance of Analysis Services is renamed, the instance ID will not change. After instance renaming is complete, directories and registry keys will continue to use the instance ID created during installation.

The registry hive is created under HKLMSoftwareMicrosoftMicrosoftSQL Server<Instance_ID> for instance-aware components. For example,

  • HKLMSoftwareMicrosoftMicrosoftSQL ServerMSSQL{nn}.MyInstance

  • HKLMSoftwareMicrosoftMicrosoftSQL ServerMSAS{nn}.MyInstance

  • HKLMSoftwareMicrosoftMicrosoftSQL ServerMSRS{nn}.MyInstance

The registry also maintains a mapping of instance ID to instance name. Instance ID to instance name mapping is maintained as follows:

  • [HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoftSQL ServerInstance NamesSQL] '<InstanceName>'='MSSQL{nn}'

  • [HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoftSQL ServerInstance NamesOLAP] '<InstanceName>'='MSAS{nn}'

  • [HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoftSQL ServerInstance NamesRS] '<InstanceName>'='MSRS{nn}'

Specifying File Paths

During Setup, you can change the installation path for the following features:

The installation path is displayed in Setup only for features with a user-configurable destination folder:

ComponentDefault pathConfigurable or Fixed Path
Database Engine server componentsProgram FilesMicrosoftSQL ServerMSSQL{nn}.<InstanceID>Configurable
Database Engine data filesProgram FilesMicrosoftSQL ServerMSSQL{nn}.<InstanceID>Configurable
Analysis Services serverProgram FilesMicrosoftSQL ServerMSAS{nn}.<InstanceID>Configurable
Analysis Services data filesProgram FilesMicrosoftSQL ServerMSAS{nn}.<InstanceID>Configurable
Reporting Services report serverProgram FilesMicrosoftSQL ServerMSRS{nn}.<InstanceID>Reporting ServicesReportServerBinConfigurable
Reporting Services report managerProgram FilesMicrosoftSQL ServerMSRS{nn}.<InstanceID>Reporting ServicesReportManagerFixed path
Integration Services<Install Directory>nnnDTS 1Configurable
Client Components (except bcp.exe and sqlcmd.exe)<Install Directory>nnnTools 1Configurable
Client Components (bcp.exe and sqlcmd.exe)<Install Directory>Client SDKODBCnnnToolsBinnFixed path
Replication and server-side COM objects<drive>:Program FilesMicrosoft SQL ServernnnCOM 2Fixed path
Integration Services component DLLs for the Data Transformation Run-time engine, the Data Transformation Pipeline engine, and the dtexec command prompt utility<drive>:Program FilesMicrosoft SQL ServernnnDTSBinnFixed path
DLLs that provide managed connection support for Integration Services<drive>:Program FilesMicrosoft SQL ServernnnDTSConnectionsFixed path
DLLs for each type of enumerator that Integration Services supports<drive>:Program FilesMicrosoft SQL ServernnnDTSForEachEnumeratorsFixed path
SQL Server Browser Service, WMI providers<drive>:Program FilesMicrosoft SQL ServernnnSharedFixed path
Components that are shared between all instances of SQL Server<drive>:Program FilesMicrosoft SQL ServernnnSharedFixed path

Warning

Ensure that the Program FilesMicrosoftSQL Server folder is protected with limited permissions.

Note that the default drive for file locations is systemdrive, normally drive C. Installation paths for child features are determined by the installation path of the parent feature.

1 A single installation path is shared between Integration Services and client components. Changing the installation path for one component also changes it for other components. Subsequent installations install components to the same location as the original installation.

2 This directory is used by all instances of SQL Server on a computer. If you apply an update to any of the instances on the computer, any changes to files in this folder will affect all instances on the computer. When you add features to an existing installation, you cannot change the location of a previously installed feature, nor can you specify the location for a new feature. You must either install additional features to the directories already established by Setup, or uninstall and reinstall the product.

Note

For clustered configurations, you must select a local drive that is available on every node of the cluster.

When you specify an installation path during Setup for the server components or data files, the Setup program uses the instance ID in addition to the specified location for program and data files. Setup does not use the instance ID for tools and other shared files. Setup also does not use any instance ID for the Analysis Services program and data files, although it does use the instance ID for the Analysis Services repository.

If you set an installation path for the Database Engine feature, SQL Server Setup uses that path as the root directory for all instance-specific folders for that installation, including SQL Data Files. In this case, if you set the root to 'C:Program FilesMicrosoftSQL ServerMSSQL{nn}.<InstanceName>MSSQL', instance-specific directories are added to the end of that path.

Customers who choose to use the USESYSDB upgrade functionality in the SQL Server Installation Wizard (Setup UI mode) can easily lead themselves into a situation where the product gets installed into a recursive folder structure. For example, <SQLProgramFiles>MSSQL14MSSQLMSSQL10_50MSSQLData. Instead, to use the USESYSDB feature, set an installation path for the SQL Data Files feature instead of the Database Engine feature.

Tinkertool mac os sierra. Note

Sql Server 2008 R2 Dev Path C:program Files Online

Data files are always expected to be found in a child directory named Data. For example, specify C:Program FilesMicrosoftSQL ServerMSSQL{nn}.<InstanceName> to specify the root path to the data directory of the system databases during upgrade when data files are found under C:Program FilesMicrosoftSQL ServerMSSQL{nn}.<InstanceName>MSSQLData.

Sql Server 2008 R2 Dev Path C:program Files Online

See Also

C:program

Sql Server 2008 R2 Dev Path C:program Files Version

Database Engine Configuration - Data Directories
Analysis Services Configuration - Data Directories