CHECK

Checks database objects for data consistency.

SYNTAX

tablespace_name Name of the tablespace you want to check.
file_name Name of the file you want to check.
table_name Name of the table you want to check.
index_name Name of the index you want to check.

DESCRIPTION

The CHECK command checks the database objects you specify for data consistency. You may want to check database consistency if queries are returning inconsistent or erroneous results, or if you are receiving frequent or unusual error messages. To execute the CHECK command, you must be the owner of the object, or have DBA or SYSADM security privileges.

DBMaker allows you to check the consistency of an entire database, or individually check indexes, tables, files, tablespaces, and the system catalog. Checking the consistency of database objects can be time and resource consuming, especially for large databases. For this reason you should use the CHECK command only when necessary, and try to schedule its use for off-peak times when inconvenience to users will be minimal.

When checking a database object, DBMaker first checks the system catalog tables to ensure all catalog information is valid and correct. If any errors are found in the system catalogs, checking will stop immediately. If the system catalog has errors, the database may have serious consistency errors.

Then DBMaker checks the physical structure and data integrity of the object and any related objects. When checking an object, DBMaker also checks all objects contained in or related to the original object; checking tables also checks indexes, checking files also checks table data pages; checking tablespaces also checks files and tables.

Some types of errors can be repaired. You can usually correct most problems with a corrupted index by dropping the index and rebuilding it. It is also possible to correct some problems with a corrupted table by unloading all records in the table, dropping the table, recreating the table, and then loading all data back into the newly recreated table.

If your database does have consistency errors, you should immediately back up your database, including all data and journal files. DBMaker can fix some types of consistency errors after recovering from a crash. To engage DBMaker's crash recovery routines, try shutting down and restarting the database. After the database restarts, execute the CHECK command again to see if the error has been corrected.

If any inconsistency still exists, please contact CASEMaker customer service immediately. CASEMaker customer support representatives will assist you with the repair of your database. For information on how to contact a CASEMaker customer service representative in your area, see your license agreement.

EXAMPLES

The following command checks the consistency of data in the Customers table.

CHECK TABLE Customers

The following command checks the consistency of data in index idxCustNum of the Customers table. When specifying an index name, you must also specify the table name.

CHECK INDEX Customers.idxCustNum

The following command checks the consistency of data pages (or frames in a BLOB file) in the customer_data file.

CHECK FILE customer_data

The following command checks the consistency of database objects in the specified tablespace. This may include files, tables, data pages in all files, and data in all tables in the ts1 tablespace.

CHECK TABLESPACE ts1

The following command checks the consistency of the database system catalogs.

CHECK CATALOG

The following command checks the consistency of all database objects.

CHECK DB

< BEGIN WORK | Contents | CHECKPOINT >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.