SQL Server: attach database with filestream error 5
-1
votes
1
answer
138
views
I'm trying to attach a database with full text catalog and filestream, but I'm having some issues with the file stream part. Here's the SQL I'm using (according to this article , this should work):
Btw, I'm using an instance running this version od SQL
use master
go
create database [Demov2] ON
(FILENAME = N'D:\Demo\Demov2.MDF'),
(FILENAME = N'D:\Demo\SQLFullTextCatalog\DemoV2_FullTextCatalog.ndf'),
(FILENAME = N'D:\Demo\LogsSQLSRA\Demov2_1.LDF'),
FILEGROUP [FileStreamGroup] contains filestream default
(Name = N'Demo_Files', FILENAME = N'D:\Demo\SQLFilestream')
for attach
go
This results in a error:
Msg 5120, Level 16, State 101, Line 5
Unable to open the physical file "D:\Demo\SQLFilestream". Operating system error 5: "5(Access is denied.)".
Msg 1802, Level 16, State 7, Line 5
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
I've tried running this as sa
and as a windows user but the result is always the same. I've also checked the folder permissions and I've added my windows account and SQL Server's service account with full control to the D:\Demo
folder and made sure that it was propagated to its children folder:

Microsoft SQL Server 2022 (RTM-GDR) (KB5021522) - 16.0.1050.5 (X64)
Jan 23 2023 17:02:42
Copyright (C) 2022 Microsoft Corporation
Developer Edition (64-bit) on Windows 10 Enterprise 10.0 (Build 22621: ) (Hypervisor)
It's clearly a permissions issue, but can anyone tell me what I'm missing?
thanks.
Asked by Luis Abreu
(151 rep)
Aug 18, 2023, 09:25 AM
Last activity: Aug 18, 2023, 10:34 AM
Last activity: Aug 18, 2023, 10:34 AM