Validating a Database

From InterBase

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.

Validating a Database Using gfix

To validate a database using gfix, follow these steps:

  1. Enter the following command:
    gfix -v
    
  2. 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).
  3. Use the gfix command to mark corrupt structures in the copied database:
    gfix -mend
    
  4. If gfix reports any checksum errors, validate and repair the database again, ignoring any checksum errors:
    gfix -validate -ignore
    
    Note:
    InterBase supports true checksums only for ODS 8 and earlier.
    It may be necessary to validate a database multiple times to correct all the errors.

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.

Database Validation Dialog

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.

See Also

Advance To: