## Unable to open the physical file

 Author Message jayoub SSCertifiable Group: General Forum Members Points: 6049 Visits: 730 I have a problem with two SQL Server 2008R2 SP3. I get the following error when i try to add a database or make a backup or attach a database. I did manage to attach a database at one point, but it would only work as read only. Unable to open the physical file "E:\Databases\databasename.mdf". Operating system error 5: "5(Access is denied.)".Unable to open the physical file "E:\Databases\databasenamelog.ldf". Operating system error 5: "5(Access is denied.)".Database 'databasename' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 5120)I have made sure that all permissions to the database folders are fine and there are no disk problems. On one server I had to install a new named instance of SQL using the same service accounts and drives and it works fine. I have not fixed the other server yetThe only thing in notice about the two of them is that SQL SP3 is installed. In the first server this issue occurred soon after installing the service pack. These are dev servers and dont get used every day dont know when the other server had SQL SP3 installed. Any help is appreciated Jeff e4d4 SSCertifiable Group: General Forum Members Points: 5128 Visits: 3149 Error is clear "Operating system error 5: "5(Access is denied.)"." So you should again check permissions on db files, folders where files reside and give sql server account read/write. Maybe inheritance of ntfs permissions is disabled? Setting permissions when UAC is on sometimes give strange results. jayoub SSCertifiable Group: General Forum Members Points: 6049 Visits: 730 Thank you very much for the reply. I will check the permissions again, but I am sure i gave the SQL Server Service account full control to the folders. Have you heard of any problems caused by SP3. Only the servers that have it installed are having the trouble. I have not installed SP3 on that new named instance I had to install to correct the first server and it is working perfectly. Your help is appreciated. Jeff GilaMonster SSC Guru Group: General Forum Members Points: 926633 Visits: 48896 Definitely a permissions error. Make sure that the SQL service account has full control over folder *and files* Gail ShawMicrosoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild: Discussions on DB performance with occasional diversions into recoverabilityWe walk in the dark places no others will enterWe stand on the bridge and no one may pass Eirikur Eiriksson SSC Guru Group: General Forum Members Points: 167321 Visits: 24226 Quick thought, (and in-line with other responses), when opening SSMS do "Run as Administrator" perrywhittle@pezzar.plus.com SSC Guru Group: General Forum Members Points: 218678 Visits: 18595 jayoub (12/12/2014)I have a problem with two SQL Server 2008R2 SP3. I get the following error when i try to add a database or make a backup or attach a database. I did manage to attach a database at one point, but it would only work as read only. Unable to open the physical file "E:\Databases\databasename.mdf". Operating system error 5: "5(Access is denied.)".Unable to open the physical file "E:\Databases\databasenamelog.ldf". Operating system error 5: "5(Access is denied.)".Database 'databasename' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 5120)I have made sure that all permissions to the database folders are fine and there are no disk problems. On one server I had to install a new named instance of SQL using the same service accounts and drives and it works fine. I have not fixed the other server yetThe only thing in notice about the two of them is that SQL SP3 is installed. In the first server this issue occurred soon after installing the service pack. These are dev servers and dont get used every day dont know when the other server had SQL SP3 installed. Any help is appreciatedHave you fixed this yet, run the PowerShell script below to check current ACLs on files and foldersget-childitem -path "drive:\path\to\files" -recurse | get-acl -----------------------------------------------------------------------------------------------------------"Ya can't make an omelette without breaking just a few eggs" ;-) jayoub SSCertifiable Group: General Forum Members Points: 6049 Visits: 730 Thank you very much for the helpI fixed it this morning by chaning the service account from a local windows account to a AD domain account. Now everything is back to normal. When a fellow dba installed SP3 on that box he had to change the Service Account from the AD Domain account to a local account. This morning I suggested we change it back and boom everything came back to normalNot sure exactly what happened b/c the local account was fine for the last few weeks. Also on the first server I had this problem with I was using the AD domain account for the services. Anyway, thank you very much for the help Jeff