Running the Integrity Checker

The Outfile.sql produced by running the Dbchkxxx.sql scripts can then be used to check the integrity of all databases in the system.

Usage

From the command prompt:

ISQL /Usa /Ppassword /Sserver_name /ilocation\outfile.sql /oreport.rpt

where:

/Ppassword

Is the password for the SA login.

/Sserver_name

Is the name of the server on which SQL Server resides.

/ilocation

Is the full path to the outfile.sql script.

outfile.sql

Is the name of the file that was created by running Dbchkcrs.sql or Dbchktbl.sql.

/oreport.rpt

Is the name of the file isql will produce that will contain the results of the integrity checks on the databases.

Remarks

The Report.rpt file produced by the second run of isql can either be checked manually before running the dumps or can be run through a DBCC report scanner.

The Dbchkxxx.sql scripts can be customized to do further processing. One option would be to add logic to put each database into single-user or read-only mode before running the DBCC commands, and take it out of single-user or read-only mode after the checks complete. This might be desirable since the DBCC commands may report spurious errors if they are run while users are updating the database. The decision to do this must be weighed against the availability requirements of the database, and whether there is a time window during which the database can be made read-only. Another option would be to change the Dbchkxxx.sql scripts so that they actually ran the DBCC commands, rather than building a script to be run later. Another option would be to have the logic encoded in a stored procedure which could be scheduled to run at specific times using the task manager in SQL Enterprise Manager.