An inconsistent database occurs when administrative changes to a database in the transaction log do not agree with information maintained in the database's configuration file.
The main causes of inconsistent database errors are improper system administration procedures. These include:
Inconsistent database errors can also be caused by hardware problems or software problems. For example, inconsistent database errors can be caused when the transaction log file or the configuration file has been corrupted by a hardware failure. Inconsistent database errors can also be caused by software bugs. In either case, contact technical support.
Note: You can also use VDBA for database backup and recovery.
Ingres automatically handles the transaction failures that cause most database inconsistencies.
If a user program exits or a transaction is aborted for some other reason, the DBMS Server automatically handles transaction rollback. This does not cause an inconsistent database.
At shutdown, all users must have exited their sessions; therefore, all transactions are committed. If users exited their sessions abnormally, the DBMS Server aborts any open transactions associated with the aborted sessions. Very long transactions take time to roll back and cause ingstop to seem to hang. The DBMS Server process cannot exit normally until it finishes recovering the aborted transactions.
If transactions are being rolled back on shutdown, allow the DBMS Server to finish this task before shutting down. If you do not, longer delays occur at startup time while the recovery process is performing rollback.
If transactions have been aborted and were not recovered by a normal shutdown, upon restart the recovery process performs recovery. This occurs, for example, if:
The recovery process performs the following steps upon startup:
Recovery actions are logged in the file $II_SYSTEM/ingres/files/iircp.log.
Note: When configured for the Ingres Cluster Solution, the log name has _nodename appended to the base log name. When the recovery process is complete, the message "Completed aborting transactions" is written to the RCP log file. Restart Ingres with the ingstart command. Users can reconnect to the databases.
If you are monitoring Ingres startup after a machine reboot, the following messages are displayed:
Starting Ingres Name Server…
Starting Ingres Communications Server…
Starting Ingres Recovery Process…
If the transaction log contained uncommitted transactions when the machine failure occurred, the startup script pauses while the recovery process recovers transactions from the transaction log file. No messages are printed to the screen.
If you are in doubt as to whether recovery is taking place during startup, or to monitor the recovery process, use the following procedure.
Display the recovery process log file by typing the following command at the operating system prompt:
Windows:
%II_SYSTEM%\ingres\files\iircp.log
UNIX:
tail -f iircp.log
VMS:
II_SYSTEM:[INGRES.FILES]IIRCP.LOG_nodename
If the system is recovering, the recovery actions are logged to the IIRCP.LOG file. This indicates that Ingres is automatically recovering from possible inconsistencies.
Messages are printed to the log file during recovery:
Recovery complete.
You can also use an operating system command to determine whether the recovery process is recovering transactions by checking to see if it is accumulating CPU time.
VMS:
You can issue the following command at the operating system prompt several times:
show process/cont/id=xxxx
where:
xxxx is the process ID of the recovery process.
If the CPU time and disk I/O count taken by the process is increasing, the recovery process is most likely recovering transactions from the log file.
UNIX:
On UNIX, you can also monitor the files in the database directory of the database you suspect of being the target of the updates that are being backed out. The following command entered at the operating system prompt shows whether data files are being updated:
ls -lt
The file most recently updated is listed first along with the time of last update.
If any of the monitoring techniques above indicate that transaction recovery is taking place, continue to monitor the recovery process until recovery has completed. When the recovery process is complete, CPU time is not accumulated.
After the recovery process has finished, restart the installation with the ingstart command. The ingstart utility first shuts down and brings up all required installation processes. Programs can connect to the databases.
If you receive an "inconsistent database" error after recovery is complete, it means updates and modifications were not properly completed or rolled back, and the database is therefore in an inconsistent state.
Following are examples of "inconsistent database" errors that indicate your database has become inconsistent:
E_DM0100 DB_INCONSISTENT Database is inconsistent
E_US0026 Database is inconsistent. Please contact the ingres system manager
E_DM9327 BAD_OPEN_COUNT
Diagnose the cause and extent of an inconsistent database problem before you attempt to recover your database. Knowing the cause of the problem is essential to choosing the proper recovery procedures. Once a database has been rolled forward from a checkpoint, recovered from an operating system backup, or forced consistent, you cannot determine the cause of inconsistency.
To diagnose the cause and extent of an inconsistent database problem:
If the configuration file can be opened and read, the cause of the inconsistency is displayed. Save the output of infodb for technical support.
If the database's configuration file, "aaaaaaaa.cnf", cannot be read, it is corrupted. You need to recover from a backup, as described in Recover an Inconsistent Database.
Common causes of inconsistent databases are:
To recover a database from an operating system backup that was made while the installation was running, see Recover an Inconsistent Database.
Changing Ingres installation variables (such as II_SYSTEM, II_DATABASE, II_CHECKPOINT, II_JOURNAL, II_DUMP, or II_WORK) without using proper procedures, causes inconsistency between the information stored in the installation variables and those stored in the database configuration file "aaaaaaaa.cnf".
Database inconsistency can occur if you move a database, table, application or some other object by using operating system commands rather than the supported Ingres utilities. If the inconsistency is the result of moving a database from another location or installation without using unloaddb, you must remove the database using destroydb, recreate the database using createdb, and repopulate the database using the unloaddb utility. For details, see the Database Administrator Guide.
A database file can become corrupted from hardware or software failures of various kinds. A data file can be inadvertently deleted by hand, but this is rare because only the user who owns the installation can write to the database directories.
If you are in doubt about whether transactions are being recovered, run the logstat utility and examine the "Status" field. It is marked RECOVER if in the recovery state. While a recovery is taking place, for example when restarting after a system failure, the recovery process requires time to read through the transaction log file to back out uncommitted transactions and complete fast-commit transactions. To users, the system appears to hang.
To examine the configuration file of your database, use the VDBA Database, Infodb menu command. You can also enter the infodb command at the command prompt.
Windows:
ingprenv
UNIX:
ingprenv
VMS:
show log ii
The following are some rules that you should keep in mind about the recovery of transactions:
E_LQ0001_STARTUP gca protocol service request failure.
After a system failure, monitor recovery and always allow it to proceed until the "Recovery Complete" message appears in iircp.log.
By disabling the logging or recovery system, the DBA can temporarily turn off logging for the database to speed bulk loading of data. If logging has been turned off for this database, a NOLOGGING error message appears in the error log file. Typically this message is:
E_DM9050_TRANSACTION_NOLOGGING Database dbname has been updated by a session running with SET NOLOGGING defined.
If the database has become inconsistent, you can check for this error message by typing the following command:
Windows:
findstr DM9050\ %II_SYSTEM%\ingres\files\errlog.log
UNIX:
grep DM9050 \$II_SYSTEM/ingres/files/errlog.log
VMS:
search -
II_SYSTEM:[INGRES.FILES]ERRLOG.LOG -
DM9050
If the NOLOGGING error message appears, logging was disabled on this database. If the NOLOGGING message in the error log was written later than the most recent checkpoint of this database, the database must be restored from the checkpoint. To determine if this is the case, compare the timestamp on the error message in errlog.log with the timestamp in the "checkpoint history" field of the output from the command infodb dbname.
For details on set nologging, see the Database Administrator Guide.
Database inconsistencies can be caused by the use of unsupported hardware configurations on NFS. In systems that include Network File System (NFS) mounts, be aware that Ingres:
To check your configuration, type mount at the operating system prompt. Make sure that the data directories (II_DATABASE, II_CHECKPOINT, II_JOURNAL and II_LOG_FILE) are not NFS-mounted from a remote node.
For a description of the supported NFS client installation procedures, see the Installation Guide.
The recommended method of recovering an inconsistent database is to use rollforwarddb from VDBA. You can also enter this command from the command line. If no Ingres checkpoint exists, you can recover from an operating system backup.
The recommended way to make your inconsistent database consistent is to use rollforwarddb. It recovers the database from a previous checkpoint and, if journaling was enabled, applies the associated journals. For the full procedure, see the Database Administrator Guide.
Ingres does not support nor recommend the use of operating system backups as your primary means of ensuring database recoverability. The Ingres checkpoint and journaling programs provide the secure way to ensure that your data is recoverable.
Important! Operating system backups must be used only as a last resort, when Ingres checkpoints have been lost or destroyed, and only under the direction of technical support.
If you have an inconsistent database for which no checkpoints or operating system backups exist, you can still gain access to that database and attempt to salvage the data using the verifydb utility.
The verifydb utility can be used to unset the "inconsistent database" flag in the configuration file "aaaaaaaa.cnf". This permits access to the database; however, it does nothing to actually make the data consistent. If verifydb is used to force access to a database that is inconsistent, the state of the database remains unknown. Such a database becomes unsupportable by technical support. Data can be lost and problems occur weeks or months later. Technical support cannot diagnose the state of such a database because the built-in consistency checks have been overridden.
The format "verifydb -oforce_consistent" does not recover a database. It merely allows access and continued operation to a database that is in an inconsistent state.
If you must use verifydb to gain emergency access to data in an inconsistent database, do so as follows:
verifydb -mreport -sdbname "dbname" -odbms_catalogs -u$ingres
Verifydb output is logged in $II_SYSTEM/ingres/files/iivdb.log:
verifydb -mruninteractive -sdbname "dbname" -oforce_consistent -u$ingres
verifydb -mruninteractive -sdbname "dbname" -odbms_catalogs -u$ingres