CREATE FILE encountered operating system error 5(Access is denied.) - On the same server


  • All,


    I have SQLServer 2008 installed on my workstation which runs under the local system account with my id being the sysadmin. I have created a database EMRDB under the C:\sql folder with the file names C:\EMRDB_Data.mdf and C:\EMRDB_Log.ldf.


    I have a Windows Account (Domain account) – AcctDM\abclogin  with which I login to SSMS and I also have another login defined in the same way (AcctDM\xyzlogin) and both are sysadmins on the server. When I detach a database on the server the other user (with AcctDM\xyzlogin) cannot attach the same database on the same server (from his workstation via SSMS). The following is the error that is seen


    <<CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\EMRDB_Data.mdf’. (.Net SqlClient Data Provider)>>


    After I granted “Full Control” on the file for the Windows Login (AcctDM\xyzlogin) then he is able to attach the file (database). I granted Full Control by right clicking on C:\EMRDB_Data.mdf and C:\EMRDB_Log.ldf from Windows Explorer, Clicking on the Security Tab and granted Full Control.


    I was wondering if there is a better way to handle this because of the number of users. Any ideas?




    Tuesday, December 06, 2011 8:15 PM


All replies