You get a bonus - 1 coin for daily activity. Now you have 1 coin

Repairing a corrupted Firebird database

Practice



Task: try to repair a Firebird database (server running on Windows).

To solve this problem, we'll use the gfix and gbak utilities that come bundled with the Firebird server. Write a batch file (bat file) with the following contents inside:

@echo off

rem Prepare the database for repair
gfix.exe -mend -user SYSDBA -pas masterkey server:c:\db\mybase.gdb

rem Dump the database to another file
gbak.exe -b -g -user SYSDBA -pas masterkey server:c:\db\mybase.gdb c:\db\backup\mybase.bak

rem Save the original database file just in case - it is still the damaged file
rename c:\db\mybase.gdb c:\db\mybase.orig

rem Now restore the database
gbak.exe -user SYSDBA -pas masterkey C:\db\backup\mybase.bak server:c:\db\mybase.gdb


Here:
-pas masterkey - the root password
C:\db\mybase.gdb - this is our damaged database
C:\db\backup - the folder where you can put database backups (make sure the backup being created doesn't overwrite a working backup, if one exists!)


If the damage isn't serious, this operation will check for glitches and bring the database back to life.

Applies to: Windows + Firebird

Comments

Игорь 17-11-2019
Что именно не получатся?
Наталья 18-10-2019
Здравствуйте! Пыталась использовать вашу информацию, но у меня ничего не получилось. так как я полный лох в программировании. Если можно было было пообщаться напрямую с вами, была бы очень благодарна. :Живу в Казахстане, обратиться не к кому рядом...

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Databases - MySql (Maria DB)"

Terms: Databases - MySql (Maria DB)