Skip to content

Commit 80a3e47

Browse files
20220131 attach and create database improvements
1 parent 99799e6 commit 80a3e47

File tree

5 files changed

+372
-274
lines changed

5 files changed

+372
-274
lines changed

docs/database-engine/configure-windows/configure-file-system-permissions-for-database-engine-access.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,37 @@ author: markingmyname
99
ms.author: maghan
1010
ms.reviewer: ""
1111
ms.custom: ""
12-
ms.date: "06/06/2016"
12+
ms.date: "01/31/2022"
1313
---
1414

1515
# Configure File System Permissions for Database Engine Access
1616
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
17-
This topic describes how to grant the [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)] file system access to the location where database files are stored. The [!INCLUDE[ssDE](../../includes/ssde-md.md)] service must have permission of the Windows file system to access the file folder where database files are stored. Permission to the default location is configured during setup. If you place your database files in a different location, you might need to follow these steps to grant the [!INCLUDE[ssDE](../../includes/ssde-md.md)] the full control permission to that location.
17+
18+
This article describes how to grant the [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)] file system access to the location where database files are stored. The [!INCLUDE[ssDE](../../includes/ssde-md.md)] service must have permission of the Windows file system to access the file folder where database files are stored. Permission to the default location is configured during setup. If you place your database files in a different location, you might must follow these steps to grant the [!INCLUDE[ssDE](../../includes/ssde-md.md)] the full control permission to that location.
1819

19-
Beginning with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] permissions are assigned to the per-service SID for each of its services. This system helps provide service isolation and defense in depth. The per-service SID is derived from the service name and is unique to each service. The topic [Configure Windows Service Accounts and Permissions](../../database-engine/configure-windows/configure-windows-service-accounts-and-permissions.md) describes the per-service SID and provides the names in the section **Windows Privileges and Rights**. It is the per-service SID that must be assigned the access permission on the file location.
20+
Beginning with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)], permissions are assigned to the per-service SID for each of its services. This system helps provide service isolation and defense in depth. The per-service SID is derived from the service name and is unique to each service. The article [Configure Windows Service Accounts and Permissions](../../database-engine/configure-windows/configure-windows-service-accounts-and-permissions.md) describes the per-service SID and provides the names in the section **Windows Privileges and Rights**. It is the per-service SID that must be assigned the access permission on the file location.
2021

21-
## To Grant File System Permission to the Per-service SID
22+
## Grant file system permission to the per-service SID
2223

23-
1. Using Windows Explorer, navigate to the file system location where the database files are stored. Right-click the file system folder, and then click **Properties**.
24+
1. Using Windows Explorer, navigate to the file system location where the database files are stored. Right-click the file system folder, and then select **Properties**.
2425

25-
2. On the **Security** tab, click **Edit**, and then **Add**.
26+
2. On the **Security** tab, select **Edit**, and then **Add**.
2627

27-
3. In the **Select Users, Computer, Service Account, or Groups** dialog box, click **Locations**, at the top of the location list, select your computer name, and then click **OK**.
28+
3. In the **Select Users, Computer, Service Account, or Groups** dialog box, select **Locations**, at the top of the location list, select your computer name, and then select **OK**.
2829

29-
4. In the **Enter the object names to select** box, type the name of the per-service SID name listed in the Books Online topic [**Configure Windows Service Accounts and Permissions**](../../database-engine/configure-windows/configure-windows-service-accounts-and-permissions.md). (For the [!INCLUDE[ssDE](../../includes/ssde-md.md)] per service SID name, use **NT SERVICE\MSSQLSERVER** for a default instance, or **NT SERVICE\MSSQL$InstanceName** for a named instance.)
30+
4. In the **Enter the object names to select** box, type the name of the per-service SID name. To locate it, see [Configure Windows Service Accounts and Permissions](../../database-engine/configure-windows/configure-windows-service-accounts-and-permissions.md). (For the [!INCLUDE[ssDE](../../includes/ssde-md.md)] per service SID name, use **NT SERVICE\MSSQLSERVER** for a default instance, or **NT SERVICE\MSSQL$InstanceName** for a named instance.)
3031

31-
5. Click **Check Names** to validate the entry. (If the validation fails, it might advise you that the name was not found. When you click **OK**, a **Multiple Names Found** dialog box appears. Now select the per-service SID name, either **MSSQLSERVER** or **NT SERVICE\MSSQL$InstanceName**, and then click **OK**. Click **OK** again to return to the **Permissions** dialog box.)
32+
5. Select **Check Names** to validate the entry. (If the validation fails, it might advise you that the name was not found. When you select **OK**, a **Multiple Names Found** dialog box appears. Now select the per-service SID name, either **MSSQLSERVER** or **NT SERVICE\MSSQL$InstanceName**, and then select **OK**. Select **OK** again to return to the **Permissions** dialog box.)
33+
3234
6. In the **Group or user** names box, select the per-service SID name, and then in the **Permissions for** \<name> box, select the **Allow** check box for **Full control**.
3335

34-
7. Click **Apply**, and then click **OK** twice to exit.
35-
36-
## See Also
37-
[Manage the Database Engine Services](../../database-engine/configure-windows/manage-the-database-engine-services.md)
38-
[Move System Databases](../../relational-databases/databases/move-system-databases.md)
39-
[Move User Databases](../../relational-databases/databases/move-user-databases.md)
40-
36+
7. Select **Apply**, and then select **OK** twice to exit.
4137

38+
## See also
39+
40+
- [Move System Databases](../../relational-databases/databases/move-system-databases.md)
41+
- [Move User Databases](../../relational-databases/databases/move-user-databases.md)
42+
43+
## Next steps
44+
45+
- [Manage the Database Engine Services](../../database-engine/configure-windows/manage-the-database-engine-services.md)
Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,71 @@
11
---
2-
title: "Move a FILESTREAM-Enabled Database | Microsoft Docs"
2+
title: "Move a FILESTREAM-enabled database"
33
description: Discover how to move a FILESTREAM-enabled database. See which Transact-SQL scripts to use in the Query Editor of SQL Server Management Studio.
44
ms.custom: ""
5-
ms.date: "03/14/2017"
5+
ms.date: "01/31/2022"
66
ms.prod: sql
77
ms.prod_service: "database-engine"
88
ms.reviewer: ""
99
ms.technology: filestream
1010
ms.topic: conceptual
1111
helpviewer_keywords:
1212
- "FILESTREAM [SQL Server], moving a FILESTREAM-enabled database"
13-
ms.assetid: dd4d270d-9283-431a-aa6b-e571fced1893
1413
author: MikeRayMSFT
1514
ms.author: mikeray
1615
---
17-
# Move a FILESTREAM-Enabled Database
16+
# Move a FILESTREAM-enabled database
1817
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
19-
This topic shows how to move a FILESTREAM-enabled database.
18+
This article shows how to move a FILESTREAM-enabled database.
2019

2120
> [!NOTE]
22-
> The examples in this topic require the Archive database that is created in [Create a FILESTREAM-Enabled Database](../../relational-databases/blob/create-a-filestream-enabled-database.md).
21+
> The examples in this topic require the `Archive` database that is created in [Create a FILESTREAM-Enabled Database](../../relational-databases/blob/create-a-filestream-enabled-database.md).
2322
2423
### To move a FILESTREAM-enabled database
2524

26-
1. In [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], click **New Query** to open the Query Editor.
25+
1. In [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], select **New Query** to open the Query Editor.
2726

28-
2. Copy the following [!INCLUDE[tsql](../../includes/tsql-md.md)] script into the Query Editor, and then click **Execute**. This script displays the location of the physical database files that the FILESTREAM database uses.
27+
2. Copy the following [!INCLUDE[tsql](../../includes/tsql-md.md)] script into the Query Editor, and then select **Execute**. This script displays the location of the physical database files that the FILESTREAM database uses.
2928

3029
```sql
31-
USE Archive
30+
USE [Archive]
3231
GO
33-
SELECT type_desc, name, physical_name from sys.database_files
32+
SELECT type_desc, name, physical_name from sys.database_files;
3433
```
3534

36-
3. Copy the following [!INCLUDE[tsql](../../includes/tsql-md.md)] script into the Query Editor, and then click **Execute**. This code takes the `Archive` database offline.
35+
3. Copy the following [!INCLUDE[tsql](../../includes/tsql-md.md)] script into the Query Editor, and then select **Execute**. This code takes the `Archive` database offline.
3736

3837
```sql
39-
USE master
40-
EXEC sp_detach_db Archive
38+
USE [master]
39+
EXEC sp_detach_db [Archive];
4140
GO
4241
```
4342

4443
4. Create the folder `C:\moved_location`, and then move the files and folders that are listed in step 2 into it.
4544

46-
5. Copy the following [!INCLUDE[tsql](../../includes/tsql-md.md)] script into the Query Editor, and then click **Execute**. This script sets the `Archive` database online.
45+
5. Copy the following [!INCLUDE[tsql](../../includes/tsql-md.md)] script into the Query Editor, and then select **Execute**. This script sets the `Archive` database online.
4746

4847
```sql
49-
CREATE DATABASE Archive ON
48+
CREATE DATABASE [Archive] ON
5049
PRIMARY ( NAME = Arch1,
5150
FILENAME = 'c:\moved_location\archdat1.mdf'),
5251
FILEGROUP FileStreamGroup1 CONTAINS FILESTREAM( NAME = Arch3,
5352
FILENAME = 'c:\moved_location\filestream1')
5453
LOG ON ( NAME = Archlog1,
5554
FILENAME = 'c:\moved_location\archlog1.ldf')
56-
FOR ATTACH
55+
FOR ATTACH;
5756
GO
5857
```
5958

60-
## See Also
61-
[sp_detach_db &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-detach-db-transact-sql.md)
62-
63-
59+
60+
## See also
61+
62+
- [Attach a database](../databases/attach-a-database.md)
63+
- [Detach a database](../databases/detach-a-database.md)
64+
- [Database Detach and Attach &#40;SQL Server&#41;](../databases/database-detach-and-attach-sql-server.md)
65+
- [CREATE DATABASE &#40;SQL Server Transact-SQL&#41;](../../t-sql/statements/create-database-transact-sql.md)
66+
- [Configure File System Permissions for Database Engine Access](../../database-engine/configure-windows/configure-file-system-permissions-for-database-engine-access.md)
67+
68+
## Next steps
69+
70+
- [Manage metadata when making a database available on another server](../databases/manage-metadata-when-making-a-database-available-on-another-server.md)
71+
- [ALTER DATABASE Compatibility Level &#40;Transact-SQL&#41;](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md)

0 commit comments

Comments
 (0)