gfix Command-line Tool

From InterBase

Go Up to Database Configuration and Maintenance

The gfix tool performs a number of maintenance activities on a database, including the following:

  • Database shutdown
  • Changing database mode to read-only or read-write
  • Changing the dialect of a database
  • Setting cache size at the database level
  • Committing limbo transactions
  • Mending databases and making minor data repairs
  • Sweeping databases
  • Displaying, committing, or recovering limbo transactions

To run gfix, you must attach as either SYSDBA or the owner of the database. Most of these actions can also be performed through IBConsole.

gfix [options] db_name

Options: In the OPTION column of the following table, only the characters outside the brackets ([ ]) are required. You can specify additional characters up to and including the full option name. To help identify options that perform similar functions, the TASK column indicates the type of activity associated with an option.

gfix Options
Option Task Description


Activate shadows

Activate shadows when the database dies. NOTE: syntax is gfix -ac (no database name).

-at[tach] n


Used with -shut to prevent new database connections during timeout period of <n> seconds; shutdown is canceled if there are still processes connected after <n> seconds.

-b[uffers] n

Cache buffers

Sets default cache buffers for the database to <n> pages.

-c[ommit] {ID| all}

Transaction recovery

Commits limbo transaction specified by ID or commit all limbo transactions.

-force n


Used with -shut to force shutdown of a database after <n> seconds; this is a drastic solution that should be used with caution.


Data repair

Used with -v to check record and page structures, releasing unassigned record fragments.

-h[ousekeeping] n


Changes automatic sweep threshold to <n> transactions.

  • Setting <n> to 0 disables sweeping.
  • Default threshold is 20,000 transactions (see Overview of Sweeping).
  • Exclusive access not needed


Data repair

Ignores checksum errors when validating or ­sweeping; InterBase supports true checksums only for ODS 8 and earlier.


Drop shadows

  • Drops unavailable shadows.
  • Syntax is gfix -k (no database name).


Transaction recovery

Displays IDs of each limbo transaction and indicates what would occur if -t were used for automated two-phase recovery.


Data repair

Marks corrupt records as unavailable, so they are skipped (for example, during a subsequent backup).

-mo[de] [read_write|read_only}

Set access mode

  • Sets mode of database to either read-only or read-write.
  • Default table mode is read_write.
  • Requires exclusive access to the database.


Data repair

Used with -v to validate corrupt or misallocated structures; structures are reported but not fixed.



Cancels a -shut operation that is scheduled to take effect or rescinds a shutdown that is currently in effect.

-pa[ssword] text

Remote access

Checks for password <text> before accessing a database.


Transaction recovery

Used with -l to prompt for action during transaction recovery.

-r[ollback] {ID| all}

Transaction recovery

Rolls back limbo transaction specified by ID or roll back all limbo transactions.



  • Shuts down the database.
  • Must be used in conjunction with -attach, -force, or -tran.

-sq[l_dialect] n

Database dialect

Changes database dialect to <n>.

  • Dialect 1 = InterBase 5.x compatibility
  • Dialect 3 = Current InterBase with SQL92 features



Forces an immediate sweep of the database.

  • Useful if automatic sweeping is disabled.
  • Exclusive access is not necessary.

-tr[an] n


Used with -shut to prevent new transactions from starting during timeout period of <n> seconds; cancels shutdown if there are still active transactions after <n> seconds.

-tw[o_phase] {ID | all}

Transaction recovery

Performs automated two-phase recovery, either for a limbo transaction specified by ID or for all limbo transactions.

-user name

Remote access

Checks for user <name> before accessing a remote database.


Data repair

Locates and releases pages that are allocated but unassigned to any data structures; also reports ­corrupt structures.

-w[rite] {sync | async | direct}


Database writes Enables or disables forced (synchronous) writes.

sync enables forced writes; async enables buffered writes; direct enables direct I/O.


Shows version of gfix and of the InterBase engine.

Examples: The following example changes the dialect of the customer.ib database to 3:

gfix -sql 3 customer.ib

The following example changes the customer.ib database to read-only mode:

gfix -mo read_only customer.ib

Advance To: