An error occurred while attaching the database to SQL2005 (error code: 5123)

Source: Internet
Author: User
Tags error code

 

Error prompt]
Data cannot be retrieved for this request. (Microsoft. SqlServer. SmoEnum) an exception occurs when other information is executed in a Transact-SQL statement or batch. (Microsoft. SqlServer. ConnectionInfo) when you try to open or Create the physical file "d: Data ***. mdf", the Create file encounters an operating system error 5 (access denied .)

[Problem background]
Database version: SQL Server 2005 Enterprise Edition
Operating system version: Windows Server 2003 Enterprise Edition
Error Description: after the database is separated, the data hard disk is mounted from one host to another (the operating system and database version of the two hosts are the same ). The above error is prompted when the result is appended to the database.

[Problem analysis]
Obviously, this is caused by insufficient file operation permissions.

[Solution]
You can solve the problem by adding corresponding users to the folder attribute security of the database file and granting them full operation permissions (this is what we say on the Internet ). Who can add permissions? For example, the Administrators User Group, network service, MSSQLUser, or Everyone user can be directly added if it is unclear or lazy. I was trying to take a screenshot. I don't know why, even images of dozens of Kb have never been uploaded successfully.

[Unexpected situation]
You may use the above solution to add the corresponding user and Operation permissions to the folder where the data file is located, but the problem persists (this is what I am struggling, why can't I do this on the Internet ~~??!). Finally, my solution is to set user and Operation permissions for each database file (including mdf, ldf, and ndf) (the operation method is the same as adding operation permissions to folders, are all security options in the right-click attribute ). The problem was finally completely solved. The reason should be that the folder permission is not automatically inherited to the files in it.

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.