39
Running
sp_iqcheckdb
In order to recover leaked storage within a database, first start the server with
the
-iqdroplks switch in the asiqsrv12 command.
Next, connect to your database and issue the command:
sp_iqcheckdb
The stored procedure reads all storage within the database. On successful
completion, it updates the database free list to reflect the true storage allocation
for the database. It then generates a report listing the working and actions it has
performed.
If it finds an error,
sp_iqcheckdb reports the name of the object and the type
of error found. It does not update the free list if any errors are detected.
Because it reads the entire database,
sp_iqcheckdb may take a long time to
run. The length of time depends on the size of the database and the size of the
machine it executes on. Typically,
sp_iqcheckdb can process between 20GB
and 100GB per hour.
The
dbcc_option settings of 1 and 3 provide a fast way to check for leaked
storage within the system. They do this by walking the various block maps, or
object directories, that make up the database. The underlying database pages
that make up the actual tables and indexes are not read. Therefore, successful
completion of
sp_iqcheckdb using option 1 or 3 does not guarantee absolutely
that the database is not corrupt.
2Runs CheckStorage. Checks for leaked blocks and corrupt
database pages by walking all the block maps in the system and
reading every database page. Runs about 50 times slower than
option 1. Produces a report of findings. Does not reset the free list.
This option is the same as the default option when
-iqdroplks is
passed to the server except that it runs in read-only mode.
3Runs CheckAllocation Fix. Server must have been started with -
iqdroplks
switch. Checks for leaked blocks by walking all block
maps in the system. Runs very fast (about 1 second per GB of
data). Produces a report of findings. If no error is detected, resets
database free list to calculated allocation map.
Sybase recommends that you use this option to recover the
database free list only when the default option cannot do so due to
errors encountered during processing, and no backed up version is
available to restore.
Value Action