Restarting Partially Completed Shrink Operations

Reissuing the same alter database command to shrink a database automatically restarts earlier partially completed shrink database operations, resuming the operation from the last completed allocation unit.

Restarting Shrink Operations that Produce Errors

After the shrink database operation moves a page, it updates all the references to this page. However, if the shrink operation runs into changes it could not complete during the page's update, it does not undo the updates it completed. Instead, the shrink operation marks the table suspect, restricting it from further use. Restarting the shrink database operation results in error message 5082, and all DML or DDL commands (except dbcc commands) that access the table return error message 12347 error when they attempt, but fail, to open the corrupted table.

Use dbcc dbrepair(dbname, redo_shrink) to fix any table corruption. This example repairs the mydb database:
dbcc dbrepair(mydb, redo_shrink)

After dbcc dbrepair clears the table's suspect status, you can restart the shrink database operation, and all DML and DDL commands can access the table.

Sybase recommends that you run dbcc checktable after running dbcc dbrepair to verify the table is repaired.