Error/Fix: Database cannot be upgraded because it is read-only or has read-only files
Yesterday during my online SQL Server class, I was trying to attach 10 GB size version of StackOverflow database that I used previosly with another instance.
When I executed below TSQL query to create databaes with attach method, received below error:-
Msg 3415, Level 16, State 5, Line 3
Database ‘StackOverflow2010’ cannot be upgraded because it is read-only, has read-only files or the user does not have permissions to modify some of the files. Make the database or files writeable, and rerun recovery.
Msg 1813, Level 16, State 2, Line 3
Could not open new database ‘StackOverflow2010’. CREATE DATABASE is aborted.

In order to resolve this error, I started google, and found below StackExchange QA:-
In my case, the solution which suggests starting SSMS as administrator did the magic.
I hope this will be helpful to you in case you face similar issue.
Happy Coding 🙂
Related
Related Posts
-
Error/Fix: SQL Server has encountered 26063 occurrence(s) of I/O requests taking longer than 15 seconds to complete
1 Comment | Jan 9, 2017 -
SQL Server – Get Database Backup History for Crash Recovery
No Comments | Apr 18, 2018 -
Analyzing Deadlock Issues
2 Comments | Feb 21, 2017 -
Error/Fix: Cannot resolve the collation conflict between “Latin1_General_CI_AS” and “SQL_Latin1_General_CP1_CI_AS” in the equal to operation
No Comments | Apr 15, 2018
About The Author
Ajay Dwivedi
I am Microsoft Certified Professional having 10+ years of experience in SQL Server Querying, Database Design, and Administration. I am fond of Query Tuning and like to automate things using TSQL & PowerShell. I also have experience of implementing end-to-end Data Warehouse solution, and Data Migration using ETL tools SQL Server Integration Services (SSIS), Pentaho Business Analytics, and have designed Database Inventory through PowerShell, Python, and Django etc.