Restore your Firebird Database from backup

Overview

The Firebird Database can be backed up in multiple ways. This document describes how you can restore the database file from a cold or hot backup using GBAK.

Prerequisites

Before executing the procedure ensure the following:

  • You have write access on the disk on which you want to restore backup.
  • You have direct access to the database file.
  • You have adequate free disk space equal to 3-4 times the size of the database being restored.

Restore from Hot Backup

  1. Through the Windows Control Panel, verify that Firebird Service is up and running.
  2. Stop TopTeam Application Server so that the TopTeam.gdb file can be restored. It must be stopped by this time because, while restoring from the backup file, it is not expected to be in use.
  3. Rename the existing TopTeam.gdb (or TopTeam.fdb) file to TopTeam-in-use-till-<<dateandtime>>.gdb or similar.
  4. Open the Command prompt and change the directory to the folder where Firebird Server is installed. You can locate the Firebird Service in the Windows Service Panel.

    The default folder where firebird is installed is:

    C:\Program Files\TechnoSolutions TopTeam\Firebird\bin

  5. Enter the following command in the Command prompt:

gbak –r –v –p <page size of database> –user <username> –pas <password> “<backed up file name with path>” “<computer name>:<database file name with path>”

<page size of database> This is the database page size. Default is 4096 or 8192 for TopTeam Database. You can change it in multiples of 1024.
<username> This is a valid Firebird Database user login. Default Username is “Sysdba”.
<password> This is a password of a login user. Default Password for SYSDBA user is “masterkey”.
<backed up file name with path> This is the name of the file that is created when the backup is completed.
<computer name> This is the name of the machine on which Firebird is installed. If Firebird Server is running on the same computer from where you are restoring the database, then you can use “localhost”.
<database file name with path> This is the database file name and path where the backed up file will be restored. The default location of this file is “C:\Program Files\TechnoSolutions TopTeam\TopTeam Database Files\TopTeam.gdb”. You can confirm this from the TopTeam Application Server “Database Settings” tab.

gbak –pas masterkey “C:\Program Files\TechnoSolutions TopTeam\TopTeam Database Files\TopTeam.bkp” “localhost:C:\Program files\Technosolutions TopTeam\TopTeam Database Files\RestoredTopTeam.gdb”


NOTE:

  • Check the restore folder to ensure that there isn’t already a file by that name.
  • On some computers, if you copy and paste the above command in the Command prompt, it does not work. In that instance, you need to type the entire command manually.
  • If you face any difficulties in restoring the database and if there are any errors while running the above command, use the switch “-y <<Log File Path>>” with the command. This switch will log all the internal workings of GBAK into the supplied file.

Syntax:

gbak –r –v –p 4096 –user sysdba –pas masterkey “C:\Program Files\Technosolutions TopTeam\TopTeam Database Files\TopTeam.bkp” “localhost:C:\Program files\Technosolutions TopTeam\TopTeam Database Files\RestoredTopTeam.gdb” -y “C:\Program files\Technosolutions TopTeam\TopTeam Database Files\GBAK_Log.txt”

The log file “GBAK_Log.txt” that is generated by the above command, sends this file to TechnoSolutions Support.

  1. When the command is completed successfully, a database file is created with the name “RestoredTopTeam.gdb”.
  • Rename the existing database file (unless already done before).
  • Rename “RestoredTopTeam.gdb” to “TopTeam.gdb” OR “TopTeam.fdb”.
  • Make sure that this file name is the same as in the “Database Settings” tab in TopTeam Application Server.

Restore from Cold Backup

  1. Stop TopTeam Application Server and ensure that no application is connected to the TopTeam.gdb file. The database must NOT be in use during this procedure.

    Default location of the database file is:
    “C:\Program Files\TechnoSolutions TopTeam\TopTeam Database Files\TopTeam.gdb” (or TopTeam.fdb), you can verify this from the TopTeam Application Server’s “Database Settings” tab.

  2. Rename the existing database file TopTeam.gdb (or TopTeam.fdb) file to TopTeam-in-use-till-<<dateandtime>>.gdb or similar.
  3. Copy the backed up file into this folder and rename it to the original file name. i.e. “TopTeam.gdb”/ OR “TopTeam.fdb”.
  4. Start Firebird Service and TopTeam Application Server.

See Also

Backup your Firebird Database file

    Revised: August 20th, 2016