gfix Command-line Tool

From InterBase
Jump to: navigation, search

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

-ac[tivate]

Activate shadows

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

-at[tach] n

Shutdown

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

Shutdown

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

-fu[ll]

Data repair

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

-h[ousekeeping] n

Sweeping

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

-i[gnore]

Data repair

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

-k[ill]

Drop shadows

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

-l[ist]

Transaction recovery

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

-m[end]

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.

-n[o_update]

Data repair

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

-o[nline]

Shutdown

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.

-pr[ompt]

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.

-sh[ut]

Shutdown

  • 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

-sw[eep]

Sweeping

Forces an immediate sweep of the database.

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

-tr[an] n

Shutdown

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.

-v[alidate]

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

Database writes Enables or disables forced (synchronous) writes.

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

-z

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

See Also