zhshqzyc
asked on
Unable to open the physical file mdf, access denied
Hello,
I want to create a new database but failed.
My script:
Thanks for help.
I want to create a new database but failed.
My script:
USE master
GO
CREATE DATABASE [AdventureWorks2008] ON
( FILENAME = N'C:\SSIS\AdventureWorks2008R2_Data.mdf' )
FOR ATTACH
GO
The error message is:Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "C:\SSIS\AdventureWorks2008R2_Data.mdf". Operating system error 5: "5(Access is denied.)".
SQL Server 2008 R2 Developer Edition.Thanks for help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I would normally go to Windows Explorer, select the directory, right click and select 'properties'. From there, select the "Security" tab.
If you don't have GUI access, you can use the commandline "icacls c:\ssis" and look thru there to see if the SQL Service account has permission.
(You MIGHT be able to do that from inside SQL with "exec xp_cmdshell 'icacls c:\ssis' ", but hopefully not... it should be locked down.
If you need help finding what permissions the service is running under, let me know.
If you don't have GUI access, you can use the commandline "icacls c:\ssis" and look thru there to see if the SQL Service account has permission.
(You MIGHT be able to do that from inside SQL with "exec xp_cmdshell 'icacls c:\ssis' ", but hopefully not... it should be locked down.
If you need help finding what permissions the service is running under, let me know.
ASKER