Restoring from backup is essential if you experience data corruption. This section explains how to recognize data corruption and what to do when it is encountered.
Data Corruption Error Messages
If you encounter any of these error messages during the course of system operation, it is an indication that some data corruption has occurred.
Internal gds software consistency check
Database file appears corrupt. Wrong page type. Page NNN is of wrong type (expected X, found Y)
Decompression overran buffer
Wrong record length
Database file appears corrupt. Bad checksum
Cannot find record back version
Next transaction older than oldest active transaction
Corrupted header page (at least)
Conversion error from string
INET/inet_error: read errno = 10054 or 10038 or 10093
Partner index description not found (175))
Sources of Data Corruption
Data corruption can occur from a number of outside sources beyond the control of the software. Here is a partial listing of these outside sources:
•An abrupt power loss or crash from unclean power
•Hard drive corruption or malfunction
•Direct editing of database tables
•Improper data import using non-DBA utilities
•Third party applications that update the database
•Users logging in during a non-GBAK update or restore process
•Restoring a non-GBAK backup to a running database
What to do if data corruption occurs
If you encounter any of the data corruption error messages listed above, immediately stop using the system and restore the last daily backup before the corruption was first noticed.
Do not keep using the system
Do not keep using the system. This can perpetuate the corruption indefinitely, making it impossible to determine how many backups you must revert to in order to find a safe restore point.
The only remedy is to restore from backup
Once a database is corrupted, your only remedy is to restore from backup. You will lose all transactions made since your last backup and must reenter them once again. If you backup daily, you can limit the amount of reentry to one day’s transactions, which is inconvenient, but achievable.
Use the Backup Manager for daily backups
Use the Backup Manager for your daily backups because it uses the GBAK backup and restore utility that is supplied with the Firebird database. Should you ever need to restore from backup due to data corruption, a GBAK restore will rebuild and clean up your database for optimal functionality.
If you do not have a backup:
If you do not have a recent backup or no backup at all, you may have to reenter days, weeks, or even months of transactions or start over with a clean database.
If you have allowed data corruption to perpetuate:
If you have allowed data corruption to perpetuate without restoring from backup at the time it was first noticed, your data may be hopelessly corrupted, requiring you to start over with a clean database.
Our ability to help is limited to recovery advice
We are not able to repair a corrupt database. Our ability to help is limited to providing support with the restore from backup process or advising how to start over with a clean database.
Database Protection Measures
You can protect your database from data corruption by taking the following measures:
Install a power protection system (UPS)
An abrupt power loss or crash from unclean power is the most common cause of data corruption. Factories are especially subject to power fluctuations. It is imperative that you protect your server with a power protection system that includes surge suppression, power conditioning, and battery backup.
Do not edit your database tables
Never directly edit or manipulate your database tables, even if you have a tool that enables you to do so. This is extremely dangerous and can result in severe data loss. This practice also violates section 5 of the DBA Software License and Maintenance Agreement.
Do not import data with non-DBA utilities
Never import data by any means other than the data import utilities included with the system. Avoid third party data import programs. The big risk you take by violating these guidelines is that you can “infect” your system with corrupt data from day one that can cause chronic problems that can never be purged from your system.
Do not use third party applications that update the database
Custom programs or reports that extract data from the database are fine, but do not use any third party program that updates the database. This is extremely dangerous and can render your system unsupportable.