Firebird Database Update

Our company has been using Firebird databases in its products for 4-5 years. Before that, we used Interbases databases. Recently, a new requirement has arisen that requires the inclusion of the Unicode character set (we are currently using the character set "NONE"). Having studied the problem, I found that the solution requires as one of the steps to update the binary format of the ODS database files (on disk). I read that the recommended solution is backing up and restoring the database using gbak utility. There is one problem with this. The original Firebird manual says:

The backup should be done using the gbak utility, which is supplied by the old ODS version of InterBase or Firebird. Recovery should be done using gbak from a newer version of Firebird.

This is a problem because the product that I have been working on has been under development for 20 years, and I really cannot say that all versions of ODS are used by our customers. Should I follow the above instructions, this would mean that my update utility should have all possible versions of the gbak utility released from Interbase 1.0 to the present day. Based on the detected versions of ODS (for example, by invoking the gstat command-line utility provided as part of the Firebird installation), I must call the correct gbak.exe file. This seems too complicated a solution for me. Can't you just use the latest gbak utility for the backup and restore phase? I am afraid that I am mistaken in this process and the data will be lost. Therefore, I can not rely solely on the gbak utility for backup, but backing up the * .gdb files manually.

+5
source share
1 answer

You can back up your database with gbak the current version of Firebird and restore with gbak the version of Firebird to which you are transferring. If this is the same version, then this is not a problem.

The instructions for the specific use of the gbak version of Firebird or Interbase that created the ODS version are usually overkill, since gbak understands the old formats. If your database works fine in the current version of Firebird, then it should be available for backup using gbak of this version. As far as I know, the meaning of the instruction is that you must restore the target version of Firebird with gbak.

Ignoring some edge cases, in general it will work with Firebird 2.5 when updating ODS. When upgrading from Firebird 2.5 to Firebird 3, you will need to follow this instruction to update correctly.

Also make sure that you are using the correct version when creating regular backups. For example, backing up the ODS 11.2 / Firebird 2.5 database with Firebird 2.1 gbak seems to work, but it will make the backup invulnerable to Firebird 2.5 because older gbaks do not know that they need to skip the RDB$ADMIN role. When restoring to Firebird 2.5, this leads to an attempt to insert a duplicate role that will violate the restore.

However, since you are changing your database to use UTF-8, you may need to recreate the database using the desired character sets and transfer the data (with the appropriate character conversions) from the old database to the new one.

+5
source

Source: https://habr.com/ru/post/1243817/


All Articles