Search code examples
firebirdinterbasefirebird-3.0

Cannot open gbk file - is it Firebird or Interbase?


We have a .gbk file that we are trying to restore to a database, in order to convert it to Postgres, but we can’t figure out the ODS or even if it is actually an Interbase file, and not a Firebird file.

We ran downloaded gbak version UI-V3.0.10.33601 Firebird 3.0 and restored it. Running gstat on the resulting file gives us:

Database header page information:
    Flags           0
    Generation      1814
    System Change Number    0
    Page size       16384
    ODS version     12.2
    Oldest transaction  1803
    Oldest active       1804
    Oldest snapshot     1804
    Next transaction    1804
    Sequence number     0
    Next attachment ID  9
    Implementation      HW=AMD/Intel/x64 little-endian OS=Darwin CC=gcc
    Shadow count        0
    Page buffers        0
    Next header page    0
    Database dialect    1
    Creation date       Jan 19, 2024 23:35:51
    Attributes      no reserve

    Variable header data:
    Sweep interval:     0
    *END*

Trying to open it with DBeaver on a Mac (as Firebird):

I/O error during "open" operation for file “myfilename”; Error while trying to open file; Operation not permitted [SQLState:08001, ISC error code:335544344]

Trying to open it with DBeaver on a PC (as Firebird):

unsupported on-disk structure for file “myfilename”: found 32780.18, support (null) (null)

I presume this means it expected 18, and I read that 32779, that is 1 lower than ours, indicates that i is a Firebird 2.x file. Is it a Firebird file because we used gbak as supplied by Firebird? It is the only version we got to work.

Trying with Interbase 2020 togo installation (PC)

gstat on the gdb file:

Wrong ODS version, expected 18, encountered 32780

Also, running gbak on our gbk file that we started with gives:

gbak: ERROR: Expected backup version less than or equal to 7. Found 9

So in summary we can’t figure out what is going on at all, it’s not clear if the file is too new or too old, or even if it is Firebird or Interbase. What is the right approach?


Solution

  • According to the message "Expected backup version less than or equal to 7. Found 9" this backup file was made by Firebird gbak version 2.5. You can restore it on any Firebird server version 2.5 or higher.

    The errors you get trying to connect to database on Mac is not related to database format but to file system permissions (not necessarily for the database file itself, it may be problem with temporary files as well). You can solve them using remote connection string instead of embedded and/or adjusting permissions on involved files.

    The error you get trying to connect to the database on PC imply that you simply copied the file from Mac which is no go because database file is platform-dependent. You can solve it by restoring the backup file on PC to create a suitable database.

    The error you get trying to restore Firebird backup using Interbase is caused by fact that Firebird and Interbase are different SQL servers even though they had common ancestor. You cannot solve it.