You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
18
19
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.
20
21
21
-
## To Grant File System Permission to the Per-service SID
22
+
## Grant file system permission to the per-service SID
22
23
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**.
24
25
25
-
2. On the **Security** tab, click**Edit**, and then **Add**.
26
+
2. On the **Security** tab, select**Edit**, and then **Add**.
26
27
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**.
28
29
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.)
30
31
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
+
32
34
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**.
33
35
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.
41
37
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)
title: "Move a FILESTREAM-Enabled Database | Microsoft Docs"
2
+
title: "Move a FILESTREAM-enabled database"
3
3
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.
4
4
ms.custom: ""
5
-
ms.date: "03/14/2017"
5
+
ms.date: "01/31/2022"
6
6
ms.prod: sql
7
7
ms.prod_service: "database-engine"
8
8
ms.reviewer: ""
9
9
ms.technology: filestream
10
10
ms.topic: conceptual
11
11
helpviewer_keywords:
12
12
- "FILESTREAM [SQL Server], moving a FILESTREAM-enabled database"
This topic shows how to move a FILESTREAM-enabled database.
18
+
This article shows how to move a FILESTREAM-enabled database.
20
19
21
20
> [!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).
23
22
24
23
### To move a FILESTREAM-enabled database
25
24
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.
27
26
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.
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.
37
36
38
37
```sql
39
-
USE master
40
-
EXEC sp_detach_db Archive
38
+
USE [master]
39
+
EXEC sp_detach_db [Archive];
41
40
GO
42
41
```
43
42
44
43
4. Create the folder `C:\moved_location`, and then move the files and folders that are listed in step 2 into it.
45
44
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.
47
46
48
47
```sql
49
-
CREATE DATABASE Archive ON
48
+
CREATE DATABASE [Archive] ON
50
49
PRIMARY ( NAME = Arch1,
51
50
FILENAME = 'c:\moved_location\archdat1.mdf'),
52
51
FILEGROUP FileStreamGroup1 CONTAINS FILESTREAM( NAME = Arch3,
- [Attach a database](../databases/attach-a-database.md)
63
+
- [Detach a database](../databases/detach-a-database.md)
64
+
- [Database Detach and Attach (SQL Server)](../databases/database-detach-and-attach-sql-server.md)
65
+
- [CREATE DATABASE (SQL Server Transact-SQL)](../../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)
0 commit comments