Backup your Firebird Database file

Overview

TopTeam Database is a critical part of TopTeam Application Server. It is important to take database backups regularly so that in the event of a system failure, you will be able to restore your database files from the saved backups.

In this article, you will learn how to backup a TopTeam Firebird Database Schema.
There are two ways to take a backup of the Firebird Database file:

  1. Hot backup
  2. Cold backup

Who should read this?

  • System Administrators
  • Database Administrators

Preparations

Before executing the backup procedures, ensure:

  • You have write access to the disk where you want to take the backup.
  • You have direct access to the database file.
  • You have adequate free disk space (equal to 2-3 times the size of the database to be backed up).

Hot Backup

You can take a backup of the database when TopTeam Application Server is running and connected to the database while TopTeam users remain connected to Application Server.

Pros

  • There is no need to stop the server before taking this backup.
  • When you restore data from this backup file, you can choose the option to change page size and coalescing space.
  • You can create a Windows Scheduler to take a backup at the frequency you choose.

Cons

  • When the database size is more than 2 GB and users are connected to the server when the backup is in progress, then some of the latest changes will not be backed up.

Cold Backup

You can take a backup of the database when no clients are connected to the database and the server is disconnected.

Pros

  • This method guarantees what is being backed up.
  • It does not have a dependency on the GBAK utilities and its versions.

Cons

  • If the backup strategy is not followed as prescribed, the backed up file will be un-usable.

You can choose any of the procedures to take a backup based on the strategy that suits you best.

Steps for a Hot Backup

1. Ensure that the Firebird Service is up and running.

2. Open the Command prompt and change directory to the folder where Firebird Server is installed.

You can identify the location of Firebird Service from the Windows Service Panel.

The default folder where Firebird is installed is:

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

3. Enter the following command in the Command prompt:
gbak –b –v –user <username> –pas <password> “<computer name>:<database file name with path>” “<backed up file name with path>”

<username> This is a valid Firebird Database user login. The default user name is “Sysdba”.
<password> This is the Password of the login user. The default Password for SYSDBA user is “masterkey”.
<computer name> This is the name of the machine where Firebird is installed. If Firebird Server is running on the same computer from where you are taking the backup, then you can use “localhost”.
<database file name with path> This is the file name and path which needs to be backed up. The default location of this file is: “C:\Program Files\Technosolutions TopTeam\TopTeam Database Files\TopTeam.fdb” (or TopTeam.gdb). You can confirm this from the TopTeam Application Server “Database Settings” tab.
<backed up file name with path> This is the name of file that is created when the backup is completed.

Example:

gbak –b –v –user sysdba –pas masterkey “localhost:C:\Program Files\Technosolutions TopTeam\TopTeam Database Files\TopTeam.fdb” “C:\Program files\Technosolutions TopTeam\TopTeam Database Files\TopTeam.bkp”

NOTE:

  • The default location of the database file is:
    “C:\Program Files\Technosolutions TopTeam\TopTeam Database Files\TopTeam.fdb”,
    (or TopTeam.gdb) – you can verify this from the TopTeam Application Server’s “Database Settings” tab.
  • 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 whole command manually.
  • When you perform a backup using GBAK, it performs Garbage Collection in the backed up file. When you restore this backup file, you will find that you have better performance and that the database file is reduced in size.
  • If you face any difficulty in the backup 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 working of GBAK into the supplied file.

Syntax

gbak –b –user sysdba –pas masterkey “localhost:C:\Program Files\Technosolutions TopTeam\TopTeam Database Files\TopTeam.fdb” “C:\Program files\Technosolutions TopTeam\TopTeam Database Files\TopTeam.bkp” –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, should be sent to TechnoSolutions support.

4. When the command has been completed successfully, a backup file will be created in the specified location. Place this backup file in a safe location or take a backup of it onto a different storage device.

Steps for a Cold Backup

1. Stop TopTeam Application Server and make sure that no application is connected to the TopTeam.fdb (or TopTeam.gdb) file.
The default location of the database file is:

“C:\Program Files\TechnoSolutions TopTeam\TopTeam Database Files\TopTeam.fdb”,
(or TopTeam.gdb) – you can verify this from the TopTeam Application Server’s “Database Settings” tab.
IMPORTANT:
If the TopTeam.fdb (or TopTeam.gdb) file is accessed by ANY Windows utility (even utilities that simply read the file) such as Copy, Backup, etc. it is possible that the original TopTeam.fdb (or TopTeam.gdb) may get corrupted.
If you copy the database file when any application is connected, there is a high probability that the copied database file will be unusable in future.

If you are not sure whether any application is connected to the database file on the network, it is best to stop Firebird Service. This will ensure that no application is connected to the database file.

2. Once the above step is completed, take a backup of the files by copying the files from Windows Explorer to another location. Once the file is copied, place it in a safe location and start Firebird Service as well as TopTeam Application Server.

See Also

Restore your Firebird Database from backup

Revised: August 20th, 2016