Validating a Database
Go Up to Validation and Repair
You should validate a database:
- Whenever a database backup is unsuccessful.
- Whenever an application receives a “corrupt database” error.
- Periodically, to monitor for corrupt data structures or misallocated space.
- Any time you suspect data corruption.
Database validation requires exclusive access to the database. Shut down a database to acquire exclusive access. If you do not have exclusive access to the database, you get the error message:
bad parameters on attach or create database - secondary server attachments cannot validate databases
To shut down a database, refer to the directions in Shutting Down a Database.
Contents
Validating a Database Using gfix
To validate a database using gfix, follow these steps:
- Enter the following command:
gfix -v
- If you suspect you have a corrupt database, make a copy of your database using an OS command (
gbak
will not back up corrupt data). - Use the
gfix
command to mark corrupt structures in the copied database:gfix -mend
- If
gfix
reports any checksum errors, validate and repair the database again, ignoring any checksum errors:gfix -validate -ignore
Note:It may be necessary to validate a database multiple times to correct all the errors.
InterBase supports true checksums only for ODS 8 and earlier.
Validating a Database using IBConsole
To validate a database using IBConsole, access the Database Validation dialog by any of the following methods:
- Select a disconnected database in the Tree pane and double-click Validation in the Work pane.
- Right-click a disconnected database in the Tree pane and choose Validation from the context menu.
- Select Database|Maintenance|Validation.
To validate database:
- 1. Check that the database indicated is correct. If it is not, cancel this dialog and re-initiate the Database Validation dialog under the correct database.
- 2. Specify which validation options you want by clicking in the right column and choosing True or False from the drop-down list. See the table below for a description of each option.
- 3. Click OK if you want to proceed with the validation, otherwise click Cancel.
When IBConsole validates a database, it verifies the integrity of data structures. Specifically, it does the following:
- Reports corrupt data structures.
- Reports misallocated data pages.
- Returns orphan pages to free space.
Option | Value |
---|---|
Validate Record Fragments |
Option values are True and False. By default, database validation reports and releases only page structures. If the Validate Record Fragments option is set to True, validation reports and releases record structures as well as page structures. |
Read Only Validation |
Option values are True and False. By default, validating a database updates it, if necessary. To prevent updating, set the Read Only Validation option to True. |
Ignore Checksum Errors |
Option values are True and False. A checksum is a page-by-page analysis of data to verify its integrity. A bad checksum means that a database page has been randomly overwritten (for example, due to a system crash). Checksum errors indicate data corruption. To repair a database that reports checksum errors, set the Ignore Checksum Errors option to True. This enables IBConsole to ignore checksums when validating a database. Ignoring checksums allows successful validation of a corrupt database, but the affected data may be lost. Note: InterBase supports true checksums only for ODS 8 and earlier. |