Sql2005 attached database error (Error number: 5123) workaround _mssql2005

Source: Internet
Author: User

"Error Tip"
Cannot retrieve data for this request. (Microsoft.SqlServer.SmoEnum) An exception occurred while other information was executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) when attempting to open or create a physical file "D:\data\***.mdf", the Create file encounters operating system error 5 (Access denied.) )

"Problem Background"
Database version: SQL Server 2005 Enterprise Edition
Operating system version: Windows Server 2003 Enterprise Edition
Error-Raising Description: After the database is detached, the data hard disk is swapped from one host to another (the operating system and database version of the two hosts are the same). When you attach a database, you are prompted for an error.

"Problem Analysis"
Obviously, it is the problem that the file operation authority is not enough.

"Workaround"
You can solve the problem by adding the appropriate user to the folder attribute security of the database file and giving the full Operation permission (the information on the Web is all that). Add permissions to what user? For example: Administrators user group, Network Service, Mssqluser or everyone, specifically, see which account your SQL service started, if not clear or lazy, you can directly add everyone user. Originally wanted to last screenshot, do not know why, dozens of KB of pictures, has been uploaded unsuccessfully.

"Unexpected Situation"
Perhaps you through the above solution, to the data file in the folder where the corresponding user and operation permissions, but the problem is still (this is my pain in the place, the internet is so said, I do not can not miles ~~??! )。 Finally, my solution is to set the user and operation permissions for each database file (including MDF, LDF, NDF), respectively, as well as the security options in the right key attribute, as is the operation method and the permissions to the folder. The problem has finally been solved completely. The reason for this is that the permissions for the folder are not automatically inherited to the file inside.

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.