DBAtlas · Database operations atlas

3906: Failed to update database because the database is read-only

SQL Server

What does it mean?

You tried to modify data (INSERT/UPDATE/DELETE/DDL) in a database marked read-only. SQL Server rejected the write.

Why does it happen?

The database was set to READ_ONLY; the connection went to a secondary replica in an Availability Group (intended for reads); the database stayed read-only after a snapshot or restore; or the file system is read-only. An application accidentally routed to a secondary replica is the typical cause.

How to fix it

If it really must be writable: ALTER DATABASE mydb SET READ_WRITE; In an Availability Group, route the application to the primary replica (check ReadWrite connection routing / ApplicationIntent). A read-only snapshot cannot be written to; target the source database instead. Also verify file permissions and the file system.

Open in DBAtlas →

More from this engine