Error 3906

Severity

16

Message text

Attempt to BEGIN TRANsaction in database ’%.*s’ failed because database is READ ONLY.

Explanation

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.


Case 1 – User transaction attempted in read-only database

A user attempted to start a transaction while the database is in read-only mode. This is not allowed.


Case 2 – Re-resolution in a read-only database

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.

Action

Corrective action depends on the scenario in which error 3906 was raised, as described in the above cases.


Case 1 – User transaction in read-only database (all versions)

Re-try the transaction when the database is no longer read-only.


Case 2 – Object re-resolution in a read-only database (all versions)

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:

  1. Put the database in read-write mode.

    1> sp_dboption <database_name>, "read only", false
    2> go
    
  2. Execute all compiled objects such as stored procedures and views once.

  3. Return the database to read-only mode.

    1> sp_dboption <database_name>, "read only", true
    2> go
    

Additional information

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.

Versions in which this error is raised

All versions