Tag Archives: mdf

SQL Server 2019 opens the data file MDF with an error

Original address: https://blog.csdn.net/rt_ 1170406609/article/details/79001990

Error message: the database ‘XXXX’ cannot be upgraded because it is read-only or has read-only files. Make the database or file writable, and then rerun the recovery operation

 

1. Copy the file to be attached to the default data directory of SQL server, and the attachment will succeed( In this way, I can normally attach data. The following methods are not tried)

 ( C:\Program Files\Microsoft SQL Server\MSSQL10_ 50.MSSQLSERVER\MSSQL\DATA)  

2. During login authentication, select “windows authentication” instead of “SQL server authentication”, even if your login account is sa;

3. If “SQL server authentication” must be used, please change the permissions of the login account so that it has full operation permissions for the files to be attached;

4. Change the login identity of the SQL Server service account from network service to local service;