CHECK DATABASE

From Lianjapedia
Jump to: navigation, search

Purpose

Checks the integrity of a database and all its tables, indexes and memo files.

Syntax

CHECK DATABASE [<database name> [REPAIR]]

See Also

ADATABASES(), ADD TABLE, ALTER INDEX, ALTER TABLE, CHECK TABLE, CLOSE DATABASES, CLOSE TABLES, COMPILE DATABASE, COPY DATABASE, CREATE DATABASE, CREATE INDEX, CREATE TABLE, CREATE VIEW, DATABASE(), DBUSED(), DISPLAY DATABASE, DISPLAY INDEXES, DISPLAY SCHEMAS, DISPLAY TABLES, DROP DATABASE, DROP INDEX, DROP TABLE, GETENV(), INDEX, LIST DATABASE, LIST INDEXES, LIST SCHEMAS, LIST TABLES, OPEN DATABASE, PACK, PACK DATABASE, REBUILD DATABASE, REINDEX DATABASE, SET AUTOCATALOG, SET EXCLUSIVE, USE

Description

The CHECK DATABASE command checks the integrity of a database and all its tables, indexes and memo files.

If the optional REPAIR keyword is specified:

  • Any detected index errors are auto repaired.
  • Any detected duplicate links in memo files are unlinked.

The CHECK DATABASE command can be run on shared data.

After execution the "_tally" system variable is set to the number of errors detected.

Example

open database southwind
check database
if _tally > 0
  check database southwind repair
endif
close database
check database southwind
if _tally > 0
  check database southwind repair
endif