3906: Failed to update database because the database is read-only
SQL ServerWhat 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.
More from this engine
- 102Incorrect syntax near 'token'
- 8114Error converting data type X to Y
- 1204The instance of the SQL Server Database Engine cannot obtain a LOCK resource
- 15023User already exists in the current database
- 18452Login failed. The login is from an untrusted domain and cannot be used with Windows authentication
- 605Attempt to fetch logical page belongs to a different allocation unit
- 4922ALTER TABLE ALTER COLUMN failed because one or more objects access this column