16
Attempt to BEGIN TRANsaction in database ’%.*s’ failed because database is READ ONLY.
Error 3906 is raised when a transaction, explicit or implicit, is attempted while the database is in read-only mode.
Error 3906 is raised with the following states:
State |
Meaning |
---|---|
1 |
Attempted to start a transaction when the database is in read-only mode. Applies to all possible transaction types. |
2 |
Attempted to start a subordinate transaction (child transaction started by a parent transaction in a parallel setting) when the database is in read-only mode. |
Error 3906 is raised in two distinct cases, described below.
A user attempted to start a transaction while the database is in read-only mode. This is not allowed.
The error may occur when a view or procedure must be resolved in a read-only database. Re-resolution must update the sysprocedures table, but since the database is read-only, error 3906 is raised. This scenario can occur during a load into a read-only database, when views and procedures must be re-resolved.
Corrective action depends on the scenario in which error 3906 was raised, as described in the above cases.
Re-try the transaction when the database is no longer read-only.
If error 3906 was raised when you attempt to select from a view or execute a stored procedure, correct the problem by making the database temporarily available for writes and re-compiling objects. Keep in mind, however, that if the database is used as a warm standby, this activity will create additional log records, which will invalidate the database as a warm standby.
To re-resolve compiled objects in the database:
Put the database in read-write mode.
1> sp_dboption <database_name>, "read only", false 2> go
Execute all compiled objects such as stored procedures and views once.
Return the database to read-only mode.
1> sp_dboption <database_name>, "read only", true 2> go
Starting with Adaptive Server Enterprise version 11.9.x, which introduced standby access mode to allow access to the database during load sequences, you can run alter database while in standby access. However since transactions cannot be started in this mode, you must re-establish the last chance threshold (LCT) after the database is fully online following the completion of the load sequence. Follow the steps in case 2 above.
All versions