Dropping Inconsistent Indexes, Tables, or Columns

Use these suggestions to resolve issues with unrepairable indexes, columns, or tables.

If sp_iqcheckdb reports unrepairable indexes, columns, or tables, then these objects must be dropped using the DROP INDEX, ALTER TABLE DROP COLUMN, or DROP TABLE statements respectively.

Note: You should not attempt to force drop objects unless Sybase Technical Support has instructed you to do so.

If you cannot drop an inconsistent object, set the temporary FORCE_DROP option. FORCE_DROP causes the IQ server to silently leak the on-disk storage of the dropped object, rather than try to reclaim it. You can recover the leaked space later using DBCC. This is desirable for an inconsistent object, because the only information about the storage of an object is within the object itself, and this information is suspect for an inconsistent object.

The FORCE_DROP database option is not allowed on a secondary node. If a force drop is attempted on a secondary node, an error is returned. FORCE_DROP is a temporary option, so that the value of the option does not get propagated to secondary nodes at synchronization.

Note: When force dropping objects, you must ensure that only the DBA is connected to the database. Restart the server immediately after a force drop.

The following procedure uses the -gd and -gm switches to restrict database access. The -gd switch only limits users who can start or stop databases on a running server. For a more restrictive method, start the server in forced recovery mode.

  1. Restart the server.
    start_iq -n bad_db_server -x 'tcpip{port=7934}' 
    -gm 1 -gd dba bad_db.db

    You must not allow other users to connect when force dropping objects.

    Use two server startup switches to restrict access:
    • Use -gd DBA so that only users with the SERVER OPERATOR system privilege can start and stop databases. (Note that the client must already have a connection to the server to start or stop the database, so this switch does not prevent connections.)

    • Use -gm 1 to allow a single connection plus one DBA connection above the limit so that a DBA can connect and drop others in an emergency.

    For more information about restricting connections, see Installation and Configuration Guide.
  2. Set the temporary option FORCE_DROP to ON.
    set temporary option FORCE_DROP = 'ON'
  3. Drop all inconsistent objects.

    Use the commands DROP INDEX, ALTER TABLE DROP COLUMN, or DROP TABLE as needed. Do not enter any other DDL or DML commands until after restarting the server.

  4. Restart the server.

    To recover the leaked space and update the allocation map to the correct state, start the server.

    start_iq -n bad_db_server -x 'tcpip{port=7934}' 
    -gm 1 -gd dba bad_db.db
  5. Run sp_iqcheckdb.
    sp_iqcheckdb 'dropleaks database';
    This step resets the database allocation map to the calculated allocation map.