www.destructor.de
GFIX is Firebird's command line tool for administration issues like data repair, sweeping, etc.
gfix [options] -user <username> -password <password> <database> [options]
-user <username> |
Database user name |
-pas[sword] <password> |
Database password |
-fet[ch_password] <filename> |
Instead of -password: Fetch password from the file so it is not visible in the command line. When <filename> is stdin, the user will be prompted for the password. [Firebird 2.5] |
When a database has been shut down, only SYSDBA and the database owner are able to connect to the database in order to perform administrative tasks.
-at[tach] <seconds> |
Used with the -shut option. Waits <seconds> seconds for all current connections to end. If after <seconds> seconds there are still connections open, the shutdown will be cancelled and return an error. |
-f[orce] <seconds> |
Used with the -shut option. Waits <seconds> seconds for all connections and transactions to end. After this time, all connections and transactions are cancelled and the database is shut down. Use with caution. |
-o[nline] |
If a -shut operation is pending, it is cancelled. Otherwise, takes a database back online |
-sh[ut] |
Shut down database. Must be used together with -attach, -force or -tran |
-shut {normal | multi | single | full} -online {normal | multi | single | full} |
Firebird 2.0 and later: New shutdown modes:
NORMAL: Database is active and online Use -shut to "go down" the scale of shutting down and -online to "go up" that scale. |
-tr[an] <seconds> |
Used with the -shut option. Waits <seconds> seconds for all running transactions to end. If after <seconds> seconds there are still running transactions, the shutdown will be cancelled. |
gfix -user SYSDBA -password "masterkey" dbserver:/db/mydb.fdb -shut -attach 60
Note that GFIX will terminate with an error if there are still connections open after 60 seconds.
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -shut -force 60
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -shut -force 0
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -online
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -shut single -force 60
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -online normal
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -shut full -force 0
-f[ull] |
Use with the -v option. Checks all records and pages and releases unassigned record fragments |
-h[ousekeeping] 0 |
Switch off automatic sweeping |
-h[ousekeeping] <n> |
Set Sweep Interval to <n> transactions (default is 20000) |
-i[gnore] |
Ignores checksum errors during a validate or sweep |
-m[end] |
Marks corrupt records as unavailable so they are skipped on a subsequent backup |
-n[o_update] |
Use with the -v option. Checks all records and pages and reports errors but does not repair them |
-sweep |
Forces an immediate sweep |
-v[alidate] |
Check database for validity. At the same time, errors are reported and repaired |
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -v -f
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -sweep
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -h 50000
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -h 0
-a[ctivate] |
Activate Shadow file for database usage |
-b[uffers] <pages> |
Default cache buffers for the database will be set to <pages> pages |
-c[ommit] <id> |
Commits limbo transaction specified by the given <id> |
-c[ommit] all |
Commits all limbo transactions |
-l[ist] |
Display IDs of all limbo transactions and what would happen to each transaction if you would use -t on it |
-mo[de] read_write |
Set mode of database to read/write (default). Requires exclusive access to database (shutdown) |
-mo[de] read_only |
Set mode of database to read-only. Requires exclusive access to database (shutdown) |
-pa[ssword] <password> |
Database password |
-p[rompt] |
Use with -l. Prompts for action. |
-r[ollback] <id> |
Rolls back limbo transaction specified by the given <id> |
-r[ollback] all |
Rolls back all limbo transactions |
-s[ql_dialect] 1 |
Sets SQL dialect 1 for the database |
-s[ql_dialect] 3 |
Sets SQL dialect 3 for the database |
-t[wo_phase] <id> |
Performs automated two-phase recovery for limbo transaction with the given <id> |
-t[wo_phase] all |
Performs automated two-phase recovery for all limbo transactions |
-user <name> |
Database username |
-w[rite] sync |
Enables Forced Writes |
-w[rite] async |
Disabled Forced Writes |
-z |
Show GFIX and server version |
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -shut -attach 60
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -shut -force 0
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -mode read_only
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -online
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -sql_dialect 3
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -write sync
gfix -user SYSDBA -password masterkey dbserver:/db/mydb.fdb -write async
Stefan Heymann, last change 2010-01-11
This documentation is licensed under (choose your favorite): GPL, LGPL, CC, IDPL, GFDL, BSD, (did I forget one?)