Starting a server in forced recovery mode

If a server fails to start with an exception or an assert during the opening of the database, then the server should be started with forced recovery. Forced recovery allows the server to start and recovers the database, if the allocation map or checkpoint information is inconsistent.

NoteForced recovery should only be used when normal database recovery fails to restore the database to a running state.

The -iqfrec server startup option is used to start the server in forced recovery mode. The database specified in the -iqfrec option is marked as in use and is restored to its last consistent state.

Forced database recovery differs from normal database recovery in these ways:

If the server fails to start due to an allocation map or checkpoint problem, follow this procedure:

StepsTo start 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 -iqfrec my_db /database/my_db.db
    

    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.

    Sybase strongly recommends that you start the IQ server with the -gd option set, to restrict server access to the DBA. Forced recovery operates in all modes, but restricted access gives the DBA greater control over inadvertent opens of the database.

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

  3. Start the server with the drop leaks option -iqdroplks. See the section “Leaked space recovery” for more details.

    start_asiq -n my_server -x "tcpip(port=2638)" -gd dba
    -iqdroplks my_db /database/my_db.db
    
  4. Run sp_iqcheckdb in allocation mode to free up unallocated pages.

    sp_iqcheckdb 'allocation database';
    
  5. Stop the server after sp_iqcheckdb finishes.

  6. 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 sections “Leaked space recovery” and “Recovering leaked space using forced recovery” for details on using sp_iqcheckdb to reclaim lost or leaked space.