602SQL Documentation Index  

Database consistency check

SQL server can make a consistency check of the database it's working with. The consistency check searches for database file structure errors. The consistency check doesn't inspect integrity constraints defined for the database tables.

The consistency check can be made along normal requests processing. The resolution of such conflicts is described further.

Consistency error types

There are two major groups of consistency errors:

The first group of errors is harmless, such errors only reduce storage space effectivity on a drive. These errors may occur each time the SQL server is not correctly terminated.

The second group of errors means that a part of stored data is overwritten or inaccessible. These errors may occur when the computer running the SQL server crashes when terminating a transaction and the transaction protection isn't turned on or the postponed data changes saving is turned on.

If a data damage is found in the database consistency check, information about the affected tables is written to the basic log.

Running database consistency check manually

The consistency check can be run interactively from the Control Panel by selecting the Tools / Database consistency tool .

The consistency check can't be run (and returns an error), if the server is processing other client's request at the same time or a separate thread is running.

If some client sends a request during manually run consistency check, the request results in an error. If a separate thread is run during the check, the thread is postponed until the check is completed.

Running database consistency check automatically

A SQL server can run the consistency check automatically on specified time intervals. If the IntegrCheckInterv property is not zero, it sets the interval (in seconds) between two consistency checks. If this property equals zero or is not specified, automatical consistency checks are not run by the server.

The interval for starting the automatical consistency check is being counted from the server start or from the end of the last finished consistency check (considering both automatical and manual consistency checks).

If the interval passes and the server is processing some request at the same time or a separate thread is running, then the consistency check is postponed.

If some client sends a request or a separate thread is run during the automatical consistency check, the check is cancelled and is run from the scratch later. If a replication action is to be run during the consistency check, it's postponed until the check is completed.

If a data damage is found in the consistency check, a message is written to the basic log.