SQL 7-errors and solutions when using the attach function of SQL Server

Source: Internet
Author: User

Today, I used the attach function of SQL Server 2008 to attach a database. A problem occurred. The error message is:

Unable to open physical file "D: \ Documents ents \ dalt \ XXXX. MDF" Operating System Error 5: "5 (error not found)" (Microsoft SQL Server: Error 5120 )".

I remember that there was no problem with the previous operations. I don't know why, so I can't find a solution on the Internet,

Http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/9e563890-e35f-4524-82b9-3cca08fec5ed

In the msdn forum, you need to add a user permission to the. MDF and. LDF files. Run the following statement to find the permission name.

1 declare @sqlser varchar(20) 
2 EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SYSTEM\CurrentControlSet\Services\MSSQLSERVER',
3 @value_name='objectname', @value=@sqlser OUTPUT
4 PRINT 'Account Starting SQL Server Service:' +convert(varchar(30),@sqlser)

The result on my machine is: account starting SQL Server Service: LocalSystem, right-click the folder containing the. MDF and. LDF files, switch to the security interface, and add the LocalSystem user. I cannot find this user here, as shown in figure

However, there are some users, such as: user (prchaz01210 \ User) and administrator (prchaz01210 \ User). I added the full control permission to the latter and tried attach again, I don't know what information the preceding statement found. I will wait for a while to check it out.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.