locked
Operating system error 5: "5(Access is denied.) RRS feed

  • Question

  • Hello

    I am trying to install some software (Intuitive ERP) and it uses the sa account to update the database. 
    But the install is erroring out.  I thought the sa account could do everything.  Some posts say give the user account permission on the folder but I don't understand what that means.  I can give windows user accounts permission on folders.  How do I give sa permission on a folder?  The mdf is causing the issue.  It is copied over during the install.  Initially it was blocked but I think I fixed that unless there is some residue left over.


    Here is the complete error message from Windows 7 pro 64 and SQL Server express 2014:


    Microsoft.SqlServer.Management.Smo.FailedOperationException: Attach database failed for Server 'MUSTAFAR'.  ---> Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: Unable to open the physical file "C:\Aptean\Intuitive ERP Server 8.7\MUSTAFAR_iERP87\iERP87_Data.mdf". Operating system error 5: "5(Access is denied.)".
       at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
       --- End of inner exception stack trace ---
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
       at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
       at Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
       at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
       --- End of inner exception stack trace ---
       at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
       at IntuitiveUI_ServerUtility.Database_AttachDatabaseFilesAction.AttachSQLDatabase()
    -------------------------------------------------------------------------------------
    Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: Unable to open the physical file "C:\Aptean\Intuitive ERP Server 8.7\MUSTAFAR_iERP87\iERP87_Data.mdf". Operating system error 5: "5(Access is denied.)".
       at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
       --- End of inner exception stack trace ---
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
       at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
       at Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
       at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
    -------------------------------------------------------------------------------------
    System.Data.SqlClient.SqlException (0x80131904): Unable to open the physical file "C:\Aptean\Intuitive ERP Server 8.7\MUSTAFAR_iERP87\iERP87_Data.mdf". Operating system error 5: "5(Access is denied.)".
       at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
       at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
    ClientConnectionId:0a4f6438-ab05-4123-a109-dbf20c8f8663
    Error Number:5120,State:101,Class:16
    -------------------------------------------------------------------------------------

    Saturday, January 14, 2017 12:01 PM

Answers

  • Thanks you helped solve my problem. 

    Although I couldn't mark any files in the directory since the install puts them there but fails during the process I used your first statement and changed the log on as to built in account; local system and that worked.

    Thanks again!

    • Marked as answer by MarDude Sunday, January 15, 2017 7:23 PM
    Sunday, January 15, 2017 7:23 PM

All replies

  • Hello,

    Open SQL Server Configuration Manager or the Services applet on Control Panel and identify which Windows account is starting SQL Server service.

    Now open the C:\Aptean\Intuitive ERP Server 8.7\ folder with File Explorer or Windows Explorer, make a right click on the MUSTAFAR_iERP87 folder, select Properties, click on the Security and provide Full Control permissions to the Windows account starting the SQL Server service .



    Hope this helps.



    Regards,

    Alberto Morillo
    SQLCoffee.com


    Saturday, January 14, 2017 2:11 PM
  • Thanks you helped solve my problem. 

    Although I couldn't mark any files in the directory since the install puts them there but fails during the process I used your first statement and changed the log on as to built in account; local system and that worked.

    Thanks again!

    • Marked as answer by MarDude Sunday, January 15, 2017 7:23 PM
    Sunday, January 15, 2017 7:23 PM