Home | Previous Page | Next Page   Administrative Utilities > The oncheck Utility >

Check Index Node Links with -ci and -cI

The -ci option checks the ordering of key values and the consistency of horizontal and vertical node links for all indexes associated with the specified table. (See Structure of B-Tree Index Pages.)

If you do not specify an index, the option checks all indexes. If you do not specify a table, the option checks all tables in the database.

If the option detects inconsistencies, it prompts you for confirmation to repair the problem index. If you specify the -y (yes) option, indexes are automatically repaired. If you specify the -n (no) option, the problem is reported but not repaired; no prompting occurs.

If oncheck does not find inconsistencies, the following message appears:

validating indexes......

The message displays the names of the indexes that oncheck is checking.

Index rebuilding can be time-consuming if you use oncheck. Processing is usually faster if you use the SQL statements DROP INDEX and CREATE INDEX to drop the index and re-create it.

The -cI option performs the same checks as -ci, but it also checks that the key value tied to a rowid in an index is the same as the key value in the row. The same -ci repair options are available with -cI.

The following example checks all indexes on the customer table:

oncheck -cI -n stores_demo:customer

The following example checks the index zip_ix on the customer table:

oncheck -cI -n stores_demo:customer#zip_ix

If indexes are fragmented on multiple partitions in the same dbspace, the oncheck -ci and oncheck -cI commands show the partition names. The following example show typical output for an index that has fragments in multiple partitions in the same dbspace:

Validating indexes for multipart:informix.t1...
                Index idx_t1
                  Index  fragment partition part_1 in DBspace dbs1
                  Index  fragment partition part_2 in DBspace dbs1
                  Index  fragment partition part_3 in DBspace dbs1
                  Index  fragment partition part_4 in DBspace dbs1
                  Index  fragment partition part_5 in DBspace dbs1

By default, the database server does not place a shared lock on the table when you check an index with the oncheck -ci or -cI options unless the table uses page locking. For absolute assurance of a complete index check, you can execute oncheck with the -x option. With the -x option, oncheck places a shared lock on the table, and no other users can perform updates, inserts, or deletes until the check has completed. For more information on option -x, see Turn On Locking with -x.

When you execute oncheck on an external index, the user-defined access method is responsible for checking and repairing an index. If an index that employs a user-defined access method cannot find the access method, the database server reports an error. The oncheck utility does not repair inconsistencies in external indexes.

Important:
If you are using the Verity Text Search DataBlade Module, the -cI option performs an index merge instead of the usual operations. IBM recommends that you do not use oncheck -cI for a table that contains more than one type of index.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]