Error/Fix: Database cannot be upgraded because it is read-only or has read-only files

Spread the love

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 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.