CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105)

前端 未结 25 2056
梦毁少年i
梦毁少年i 2020-12-13 23:44

I have a database file .mdf from MS SQL EXPRESS in folder:

C:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQLEXPRESS\\MSSQL\\DATA
相关标签:
25条回答
  • 2020-12-14 00:04

    I just decided to create the file in D: instead of C: and everything worked well. windows 7...10 have many issues regarding the sharing and authorization of files and folder..

    0 讨论(0)
  • 2020-12-14 00:05

    I had this issue on Windows 2003 with SQL 2005. I had to take ownership of the files as my Windows user account and I got the database to attache that way.

    You have to right click on the file, select Properties, click OK to get past the information screen, click the Advanced button, select your account from the listing of available accounts or groups, apply that change, and Click OK on the Properties screen. Once you have done all that you will be able to manage the file permissions.

    I logged into SSMS with Windows Authentication and I was able to attach the database without error.

    Cheers!

    0 讨论(0)
  • 2020-12-14 00:06

    Right Click on File mdf and ldf properties -> security ->full permission

    0 讨论(0)
  • 2020-12-14 00:06

    The key is "operating system error 5". Microsoft helpfully list the various error codes and values on their site

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

    ERROR_ACCESS_DENIED 5 (0x5) Access is denied.

    0 讨论(0)
  • 2020-12-14 00:08

    1.copy your --.MDF,--.LDF files to pate this location For 2008 server C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA 2.In sql server 2008 use ATTACH and select same location for add

    0 讨论(0)
  • 2020-12-14 00:09

    It's a Windows permissions issue. If you connected to your server using Windows Authentication then that Windows user needs permissions to the file. If you connected to your server using SQL Server authentication then the SQL Server instance account (MSSQL$, e.g. MSSQL$SQLEXPRESS) needs permissions to the file. The other solutions suggesting logging in as an administrator essentially accomplish the same thing (with a bit of a sledgehammer :).

    If the database file is in your SQL Server's data folder then it should have inherited the user rights for the SQL Server account from that folder so the SQL Server authentication should have worked. I would recommend fixing the SQL Server instance's account's rights for that folder. If the data file is somewhere else and the SQL Server account does not have permissions then you will likely encounter other problems later. Again, the better solution is to fix the SS account rights. Unless you are always going to log in as administrator...

    0 讨论(0)
提交回复
热议问题