Our company is using Firebird databases in its products already 4 - 5 years. Before that we have been using Interbases databases. Recently there come new requirement which requires to enable unicode character set (currently we are using character set 'NONE'). After investigating the issue I found that the solution require as one of steps upgrading ODS (on-disk-structure) binary format of database files. I have read that the recommended solution is to backup and then restore the database using gbak utility. There is one problem with this. In the original manual to Firebird there is written:
The backup should be taken using the gbak utility supplied by the old ODS version of InterBase or Firebird. The restore should be carried out using gbak from the newer version of Firebird.
This is problem because product I am working on is being developed for 20 years and I really can't say what all ODS versions are in use by our customers. Should I follow above mentioned instructions it would mean, that my upgrade utility should have all the possible versions of gbak utility released from Interbase 1.0 to these days. Based on detected ODS versions (for example by calling command line utility "gstat" delivered as part of Firebird installation) I should call the correct gbak.exe file. This seems overly complicated solution to me. Isn't possible to just use the newest gbak utility for both backup and restore phase ? What I am afraid of is that I make somewhere mistake in this process and data will be lost. So I can't rely solely on gbak utility for backup but backup *.gdb files manually.
You should be able to backup your database with the gbak of your current Firebird version, and restore with the gbak of the Firebird version you are migrating to. If that is one and the same version, then that is no problem.
The instruction to specifically use the gbak of the Firebird or Interbase version that created the ODS version is - usually - overkill as gbak understands the older formats. If your database works fine on the current Firebird version, then it should be possible to backup with the gbak of that version. As far as I know the meaning of the instruction is that you should restore with the gbak of the target Firebird version.
Ignoring some edge cases, in general it will work up to Firebird 2.5 when upgrading ODS. When migrating from Firebird 2.5 to Firebird 3 you will need to follow this instruction to correctly upgrade.
Also make sure when making normal backups that you use the right version. For example backing up an ODS 11.2/Firebird 2.5 database with the Firebird 2.1 gbak will seem to work, but it will make the backup unrestorable on Firebird 2.5 because older gbaks don't know that they need to skip the RDB$ADMIN
role. On restore to Firebird 2.5 this results in an attempt to insert a duplicate role, which will break the restore.
However as you are changing your database to use UTF-8, you might want to consider creating the database anew with the right character sets, and pumping the data (with appropriate character set conversions) from the old database to the new.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With