Starting servers in forced recovery mode

If a server fails to start with an exception or an assert when opening a database, start the server with forced recovery. Forced recovery allows the server to start if the allocation map or checkpoint information is inconsistent. In this mode, options display information about inconsistencies. You can also specify options to repair such inconsistencies.

NoteUse forced recovery only when normal database recovery fails to restore the database to a running state.

Restricting database access during recovery

Restricting access gives the DBA greater control over inadvertent opens of the database during forced recovery. Sybase recommends using two server startup switches to restrict access:

An alternate way to restrict connections is to specify

sa_server_option('disable_connections', 'ON')

just after you start the connection where you are performing forced recovery and

sa_server_option('disable_connections', 'OFF')

on the same connection after recovery. The disadvantage is that this method precludes emergency access from another DBA connection.

StepsStarting a server in forced recovery mode

  1. Start the server with forced recovery (to mark all pages as used), using the -iqfrec server startup option in the start_asiq command. For example:

    start_asiq -n my_server -x 'tcpip(port=7934}'
    -gd dba -gm 1 -iqfrec my_db /database/my_db.db
    

    Forced recovery starts the server in single-node mode. Stop all query servers first.

    WARNING! You must specify the override startup switch (-iqmpx_ov 1) and start in single node mode (-iqmpx_sn 1) when starting a multiplex write server after any failure. Never use multiplex mode (the default) for recovery.

    You specify the database name twice, once to specify the database undergoing forced recovery and once to specify the database to start. The -iqfrec server startup option requires the database name. Note that this is the physical database name, which is case sensitive. Do not use select_dbname to determine the database name, as it returns the logical name assigned by the -n startup option.

  2. If desired, you can run sp_iqcheckdb to check for leaked blocks. For details, see “Analyzing allocation problems”.

  3. Stop the server after it has started successfully. To stop the server, use stop_asiq on UNIX or the shutdown button in the console window on Windows.

  4. Restart the server using your usual method, without the -iqfrec and -iqdroplks options.

If you are unable to start your server in forced recovery mode, contact Sybase Technical Support.

Using forced recovery without a follow on sp_iqcheckdb

Running forced recovery starts the database in a valid, but fully allocated mode. In other words, you should be able to do all operations, but no permanent main dbspace is left. Before you do anything else, you must either recover the lost dbspace by running sp_iqcheckdb with the -iqdroplks flag, or add a new dbspace. Note that queries should also run successfully, since they do not need additional permanent dbspace; however, you cannot load, insert, or delete data.

WARNING!  Running queries without verifying the database will not cause any inconsistency in your data. However, if there is a problem in the data that caused the server to fail, the server could fail again or produce incorrect results.

See the section “Recovering leaked space” for details on using sp_iqcheckdb to reclaim lost or leaked space.