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:
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!
Recommended Online Courses:
- Introduction to Azure SQL Database for Beginners
- SQL Server 2019: What’s New – New and Enhanced Features
- SQL Server Fundamentals – SQL Database for Beginners
- Essential SQL Server Administration Tips
- Boost SQL Server Database Performance with In-Memory OLTP
- Essential SQL Server Development Tips for SQL Developers
- Working with Python on Windows and SQL Server Databases
- Introduction to Computer Programming for Beginners
- .NET Programming for Beginners – Windows Forms with C#
- Introduction to SQL Server Machine Learning Services
- Entity Framework: Getting Started – Complete Beginners Guide
- How to Import and Export Data in SQL Server Databases
- Learn How to Install and Start Using SQL Server in 30 Mins
- A Guide on How to Start and Monetize a Successful Blog
Other related SQL Server troubleshooting articles to check on SQLNetHub:
- The multi-part identifier … could not be bound
- Operating System Error 170 (Requested Resource is in use)
- Installing SQL Server 2016 on Windows Server 2012 R2: Rule KB2919355 failed
- The operation failed because either the specified cluster node is not the owner of the group, or the node is not a possible owner of the group
- A connection was successfully established with the server, but then an error occurred during the login process.
- SQL Server 2008 R2 Service Pack Installation Fails – Element not found. (Exception from HRESULT: 0x80070490)
- There is insufficient system memory in resource pool ‘internal’ to run this query.
- Argument data type ntext is invalid for argument …
- … more SQL Server troubleshooting articles
Recommended Software Tools
Snippets Generator: Create and modify T-SQL snippets for use in SQL Management Studio, fast, easy and efficiently.
Artemakis Artemiou, a distinguished Senior Database and Software Architect, brings over 20 years of expertise to the IT industry. A Certified Database, Cloud, and AI professional, he earned the Microsoft Data Platform MVP title for nine consecutive years (2009-2018). As the founder of SQLNetHub and GnoelixiAI Hub, Artemakis is dedicated to sharing his knowledge and democratizing education on various fields such as: Databases, Cloud, AI, and Software Development. His commitment to simplicity and knowledge sharing defines his impactful presence in the tech community.
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
OR you can run SSMS as Admininistrator
Thanks – it solved my issue just opening SSMS as Administrator! 🙂