Page tree
Skip to end of metadata
Go to start of metadata

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 three 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.

Case 3 – Re-resolution in an online for standby-only database

The error may occur when a view or procedure must be resolved in a standby-only database. Re-resolution must update the sysprocedures table, but since the database is standby-only, error 3906 is raised. This scenario can occur when attempting to use a compiled object such as a stored procedure in an online for standby-only database.

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.

    Return the database to read-only mode.

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

     

Case 3 – Re-resolution in an online for standby-only database 

Standby-only mode is designed to allow access to data for reporting purposes while retaining the ability to load transaction dumps to maintain a warm standby.  The error could be worked around by issuing a full online database, but the ability to load subsequent transaction logs is then lost.  The best solution for this case is to create copies of the procedures necessary for the reporting being done in another database on the server, substituting fully qualified object names to reference the tables in the standby-only database.  As this other database would be in normal mode, the procedure can be re-resolved as changes would then be made in the other database.

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

  • No labels