We have a database that we restored to a server and have been read/writing to that database for quite some time. We are now trying to apply TDE to that database and it will not allow us because it says the database has some read only files. Looking at the files via SSMS, we see nothing strange, but when we query sys.database_files, we see the attribute "is_media_read_only" set to one. No other database in our system has that set, so we a fairly confident this is the culprit. I was able to "unset" on the log file by detaching the database and re-attaching without the log (which created a new log file with this attribute "unset"). I also tried to create a new file in the primary filegroup and transition the data to the new file (and then drop the old file), but that can't be done on a "root" file, since boot data is available there. Also, generic backup/restore does not work. I suspect this database was once part of an always on availability group and served as a secondary replica (where the backup was taken), but that was long ago and no going back.

Any ideas on how to unset this so we can apply TDE?

enter image description here

New contributor
petedba is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    Is there a filegroup set to READ-ONLY or just the file shows that information? – Ronaldo Sep 11 at 16:57
  • No - all file groups are set to read/write (only one - Primary) and the database has been read/write for some time now – petedba Sep 11 at 20:09
  • What about the attribute read-only of the file properties on windows? Please, verify that it's not checked. Also, have you run a DBCC CHECKDB just to make sure it's not a corrupted file? – Ronaldo Sep 11 at 22:28
  • It is not corrupted (yes - ran checkdb) and the file system properties are not set (we can move this database to any server/any location with backup/restore - same issue). – petedba Sep 11 at 22:32
  • If you generate the scripts of creation of that database, does it create a new one on the same state of read-only? If not, it might be an idea to export the data to the new one in case no solution to change the property on the original db is given. – Ronaldo Sep 11 at 22:38

Your Answer

petedba is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.