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
-
Easy Trick to Debug Long TSQL Codes
No Comments | May 6, 2017 -
Error/Fix: Database Mails using Gmail getting to Unsent Items
No Comments | Sep 10, 2017 -
SQL Server – Get Database Backup History for Crash Recovery
No Comments | Apr 18, 2018 -
Script-SQLDatabaseRestore cmdlet in SQLDBATools Module
No Comments | Apr 14, 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.