Dropping inconsistent indexes, tables, or columns

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.

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

If FORCE_DROP is set to 'ON', you cannot drop a join index on a multiplex write server. To force drop a join index on a multiplex write server, you must first start the server in single-node mode, and after the drop, restart only the write server.

NoteWhen 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, see “Restricting database access during recovery”.

StepsDropping inconsistent objects

  1. Restart the server.

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

    Sybase recommends using two server startup switches to restrict access:

    • Use -gd DBA so that only users with DBA authority 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 Sybase IQ 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 with the -iqdroplks option set. You can set this option now, as shown in this example, or whenever you restart the server.

    start_asiq -n bad_db_server -x 'tcpip{port=7934}' 
    -iqdroplks bad_db bad_db.db
    

    You specify the database name twice, once to specify which database you are starting (with no path), and once to identify the database for the -iqdroplks option (pathname optional).

  5. Run sp_iqcheckdb.

    sp_iqcheckdb 'allocation database';
    

    This step resets the database allocation map to the calculated allocation map.

For more information, see the sections “Recovering leaked space” and “Database verification”.