Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Fix corrupted database through DOS command

1. Open up Command Prompt


2. Change directory (use command cd) to Firebird\Firebird_x_x\bin folder.
3. Then key in this: gfix -v -full database.fdb
4. Then this: gfix -mend -full -ignore database.fdb
5. Then this again: gfix -v -full database.fdb
6. Then try backup without garbage collection: gbak -backup -v -ignore -garbage
database.fdb database.fbk
7. Finally try restore: gbak -create -v database.fbk database_ok.fdb

This is the usual way I use to fix fdb which cannot be repaired using utility. If
this fail, then only FB expert can help fix, but with charges.

Notes:
database.fdb = "C:\Entrypass\P1_Server\event\trans.fdb"

1. gfix -v -full "C:\Entrypass\P1_Server\event\trans.fdb"


2. gfix -mend -full -ignore "C:\Entrypass\P1_Server\event\trans.fdb"
3. gfix -v -full "C:\Entrypass\P1_Server\event\trans.fdb"
4. gbak -backup -v -ignore "C:\Entrypass\P1_Server\event\trans.fdb" "C:\Entrypass\
P1_Server\event\trans.fbk"
5. gbak -create -v "C:\Entrypass\P1_Server\event\trans.fbk" "C:\Entrypass\
P1_Server\event\trans_OK.fdb"

fail in step 4

gfix -mode read_only "C:\Entrypass\P1_Server\event\trans.fdb"

continue step 4

after finish step 5 must do this command

gfix -mode read_write "C:\Entrypass\P1_Server\event\trans.fdb"

For firebird 64bit

1. gfix -v -full -user sysdba -fet stdin "C:\Entrypass\P1_Server\event\trans.fdb"


2. gfix -mend -full -ignore -user sysdba -fet stdin "C:\Entrypass\P1_Server\event\
trans.fdb"
3. gfix -v -full -user sysdba -fet stdin "C:\Entrypass\P1_Server\event\trans.fdb"
4. gbak -backup -v -ignore -gar -user sysdba -fet stdin "C:\Entrypass\P1_Server\
event\trans.fdb" "C:\Entrypass\P1_Server\event\trans.fbk"
5. gbak -create -v -user sysdba -fet stdin "C:\Entrypass\P1_Server\event\trans.fbk"
"C:\Entrypass\P1_Server\event\trans_OK.fdb"

fail in step 4

gfix -mode read_only -user sysdba -fet stdin "C:\Entrypass\P1_Server\event\


trans.fdb"

continue step 4

after finish step 5 must do this command

gfix -mode read_write -user sysdba -fet stdin "C:\Entrypass\P1_Server\event\


trans.fdb"
Complete Steps:

1. Open Command prompt


2. Type cd\ to go to C: drive (C:\>)
3. Change directory (use command cd) to Firebird\Firebird_x_x\bin folder.
Example: if your Windows 7 is 64 bit:
C:\>cd Program Files (x86)
C:\Program Files (x86)> cd Firebird
C:\Program Files (x86)\Firebird>cd Firebird_2_1
C:\Program Files (x86)\Firebird\Firebird_2_1>cd bin
C:\Program Files (x86)\Firebird\Firebird_2_1\bin>
* If you��re not using Windows 7 (64bit), please allocate the Firebird folder in
your system.
4. Type the following command step by step (5 steps) under the Step 3 directory
path
a. gfix -v -full "C:\Entrypass\P1_Server\event\trans.fdb"
Example: C:\Program Files (x86)\Firebird\Firebird_2_1\bin>gfix -v -full "C:\
Entrypass\P1_Server\event\trans.fdb"
b. gfix -mend -full -ignore "C:\Entrypass\P1_Server\event\trans.fdb"
c. gfix -v -full "C:\Entrypass\P1_Server\event\trans.fdb"
d. gbak -backup -v -ignore -garbage "C:\Entrypass\P1_Server\event\trans.fdb"
"C:\Entrypass\P1_Server\event\trans.fbk"
e. gbak -create -v "C:\Entrypass\P1_Server\event\trans.fbk" "C:\Entrypass\
P1_Server\event\trans_OK.fdb"
* Please perform all the above 5 steps follow by sequence. Each step will
require some time to perform. Please be patient.
5. After finished all the above 5 steps (under No. 4), please go to following
folder: "C:\EntryPass\P1_Server\Event\", and rename the following files:
a. Rename existing "Trans.fdb" to "Trans_old.fdb"
b. Rename "Trans_OK.fdb" to "Trans.fdb"
6. Done

Here are some of the causes of database corruption (extracted from above link)
which may relates to your customer�K
1. Abnormal termination of the server computer, especially an electrical power
interruption. For the IT-industry it can be a real blow and that is why we hope
there is no need to remind you once again about the necessity of having a source of
uninterrupted power supply on your server.
2. Defects and faults on the server computer, especially the HDD (hard disk drive),
disk controllers, the computer's main memory and the cache memory of Raid
controllers.
3. File copy or other file access to the database when the server is running.
4. Exhaustion of free disk space when working with the database.

*** internal gds software consistency check (cannot start thread) ***

You might also like