Failed to attach database, cannot upgrade database because it is read-only

Source: Internet
Author: User
Tags microsoft sql server

I deal with the method is to find the specified directory of the database of these 2 files, set Evvryone have all the rights, after the successful, the system will automatically adjust the permissions, change to SQL administrator has permissions, no manual adjustment back.

Back is the online digest

To search the Internet to find the answer, and finally found that the permissions of the NTFS problem, NTFS format permissions to set a lot of options, but it also brings a lot of problems, iis,sql, and so some of the inexplicable problems may originate from the rights unassigned, this issue is also out here.

The solution is simple: give the user the Full Control permission on the folder where the file is located or the person you are working on the database to solve the problem. If the property does not have a users user, add one manually.

Attach the online solution:

After consulting the data, found that is not a file read-only problem, strictly speaking should be a "permission" problem, the current SQL Server login account does not have to attach files to write permission, there will be the above "read-only" hint, the solution has the following several ways:

1. Copy the attached file to the SQL Server default Data directory, at which point the add-on will succeed;

2. At logon authentication, choose Windows Authentication instead of SQL Server authentication, even if your login account is sa;

3. If you must use SQL Server authentication, change the permissions on the login account to have full operational rights to the file you want to attach;

4. Change the account logon status of SQL Server service from Network service to local service;

No way, just step back, modify the connection string in config, change to Windows authentication, and then attach the database with Windows authentication.

The following error occurred today when attaching a SQL Server 2000 database to SQL Server 2005: The attached database failed for server (MICROSOFT.SQLSERVER.SMO), database test cannot be upgraded because it is read-only, Or have read-only files. Make the database or file writable, and then rerun the recovery operation. (Microsoft SQL Server, error: 3415)

Viewed the database files, they do not have read-only properties, and the addition of SQL Server 2000 is all normal.

After consulting the data, found that is not a file read-only problem, strictly speaking should be a "permission" problem, the current SQL Server login account does not have to attach files to write permission, there will be the above "read-only" hint, the solution has the following several ways:

1. Copy the attached file to the SQL Server default Data directory, at which point the add-on will succeed;

2. At logon authentication, choose Windows Authentication instead of SQL Server authentication, even if your login account is sa;

3. If you must use SQL Server authentication, change the permissions on the login account to have full operational rights to the file you want to attach;

4. Change the account logon status of SQL Server service from Network service to local service;

I encountered this situation, using the second method to solve the problem.

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.