Unable to open the physical file

  • 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 yet

    The 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

  • 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.

  • 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

  • Definitely a permissions error. Make sure that the SQL service account has full control over folder *and files*

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Quick thought, (and in-line with other responses), when opening SSMS do "Run as Administrator"

    😎

  • 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 yet

    The 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

    Have you fixed this yet, run the PowerShell script below to check current ACLs on files and folders

    get-childitem -path "drive:\path\to\files" -recurse | get-acl

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Thank you very much for the help

    I 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 normal

    Not 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

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply