For the database to operate correctly it is vital that the physical structures of the database be correct. It is, however, not always possible to preclude violations of physical consistency due to system errors. In contrast to inconsistencies, such violations are termed consistency errors from the DBH point of view. The UDS/SQL utility routine BCHECK allows the user to check the physical structures of the database when problems occur or within the course of periodic data saving and thus uncover potential consistency errors at an early stage. Since BCHECK can pinpoint each error precisely, it is possible to correct a database containing errors and thus avoid further errors.
BCHECK uses the redundancy principle when checking UDS/SQL databases. First of all, it checks the local data in a page on the one hand and, on the other, the predefined physical structures and the DBDIR metadata on the basis of the SIA (local consistency). Next, BCHECK checks the consistency of logically associated system data located on different pages, again on the basis of the SIA (global consistency).
It is not possible to check the logical consistency of user data, since no information concerning the reference data or the validity of the user data in the database is available to UDS/SQL.
The following can be checked: the user realms of the database, the PRIVACY-AND-IFQ database in the DBDIR, and the compiler database in the DBCOM. BCHECK only checks realms on disk.
It is not always necessary to check the entire database: it is also possible to restrict the check range to individual realms, record types, sets or search keys and consistency criteria, thereby saving time. The depth of the check can be likewise restricted by excluding the management structures for the storage of records or the key values of ASC keys, DESC keys or search keys from the check.
As of UDS/SQL V2.6 BCHECK uses I/O transfer lengths of over 32 K when reading in database pages. The minimum possible I/O transfer length of all disks on which the relevant database realms are located is used here.