Database [Database_Name] cannot be upgraded because it is read-only or has read-only files

This article, discusses how you can resolve the error “Database [Database_Name] cannot be upgraded because it is read-only or has read-only files“.

 

About the Error Message

At some point in the past, I was trying to attach some databases on a SQL Server 2005 instance. The database files were copied over the network and located on a drive on the DBMS server.

Though, while I was trying to attach the databases I was getting an error message of the following type:

Msg 3415, Level 16, State 3, Line 1
Database [database_name] cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.
Msg 1813, Level 16, State 2, Line 1
Could not open new database [database_name]. CREATE DATABASE is aborted.

 

How to Resolve the Issue

As the error message was saying, I checked the permissions of the database files and ensured that they were not read-only. Also, the service user account running the SQL Server instance had full access on the files.

As I did not have much time for fully troubleshooting the issue, I provided full access to “Everyone” on all the database files I wanted to attach, and tried again.

Guess what? It worked 🙂

After the databases were successfully attached, I removed the full access from the “Everyone” entity and so everything was back to normal!

 


Strengthen your SQL Server Administration Skills – Enroll to our Online Course!

Check our online course on Udemy titled “Essential SQL Server Administration Tips
(special limited-time discount included in link).

Via the course, you will learn essential hands-on SQL Server Administration tips on SQL Server maintenance, security, performance, integration, error handling and more. Many live demonstrations and downloadable resources included!

Essential SQL Server Administration Tips - Online Course with Live Demonstrations and Hands-on Guides
Lifetime Access / Live Demos / Downloadable Resources and more!

Learn More


Recommended Online Courses:

 

Other related SQL Server troubleshooting articles to check on SQLNetHub:

 

Recommended Software Tools

Snippets Generator: Create and modify T-SQL snippets for use in SQL Management Studio, fast, easy and efficiently.

Snippets Generator - SQL Snippets Creation Tool

Learn more

 

Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading...

Reference: SQLNetHub (https://www.sqlnethub.com)

© SQLNetHub

3 thoughts on “Database [Database_Name] cannot be upgraded because it is read-only or has read-only files”

  1. I had the same issue on SQL Server 2008 R2 today – turns out you don't need to mess with permissions on the files. It's caused by the wonderful UAC crap in Server 2008 R2 – I launched the SSMS as administrator (right-click – warning etc) and it worked perfectly. Thanks Microsoft for misleading us with this article that comes up first in Google search: http://support.microsoft.com/kb/931640

Comments are closed.