#FAQ: 10129-EN, Date: 05/22/2009

How to automate the backup of the database of NewWayService 4 using the Firebird "gbak" utility.


The information in this article applies to :
NewWayService 4.x (English)
NewWayService 4.x (French)


Description
The gbak utility included with Firebird is a command line utility. This utility can be called from a script file and you can schedule the script from a task scheduler software such as the schedule service under Windowsor the cron daemon under Linux or Unix.


Solution
You just have to call the gbak utility from the script file. Refer to the NewWayService 4 installation guide for more information about backing up the database.

Example of a script under Windows
This example backups the NewWayService 4 database (file nws.fdb) that is located in the C:\Program Files\OroLogic\NewWayService4 folder on the Windows server then create the file nws.fbk in the same folder. The gbak utility is located in the C:\Program Files\Firebird\Firebird_2_1\bin\ folder. This script is ran directly from the server.


REM BEGIN SCRIPT
"C:\Program Files\Firebird\Firebird_2_1\bin\gbak" -B -USER SYSDBA -PASSWORD masterkey "C:\Program Files\OroLogic\NewWayService4\nws.fdb" "C:\Program Files\OroLogic\NewWayService4\nws.fbk"
REM END SCRIPT


Important notice: The command above will work only if it is run directly from the server console. This command will not work if you run it through a client terminal server session or for example if the command is run in background from a task scheduler software. In such case, you must specify the server name as well as the port number on which Firebird is running (TCP/IP syntax). Usually, the default port number used is 3050. Verify your NewWayService 4 connection parameters to see which port number to use in the command.

Here is the same example as above, except that the server name and port number is specified:

REM BEGIN SCRIPT
"C:\Program Files\Firebird\Firebird_2_1\bin\gbak" -B -USER SYSDBA -PASSWORD masterkey "localhost/3050:C:\Program Files\OroLogic\NewWayService4\nws.fdb" "C:\Program Files\OroLogic\NewWayService4\nws.fbk"
REM END SCRIPT

In this example, the server is named localhost and the port number on which Firebird is running is 3050. Note that you must add the character / between the server name and the port number and add the character : after the port number. Please, also note that you could enter the IP address of the server instead of its name.


Example of a script under Linux or Unix
This example backups the NewWayService 4 database (file nws.fdb) that is located in the /home/newwayservice4 folder on Linux or Unix server and create the backup file nws.fbk in the same folder The gbak utility is located in the /opt/firebird/bin folder. This script is ran directly from the server.


# BEGIN SCRIPT
/opt/firebird/bin/gbak -b -user SYSDBA -password masterkey /home/newwayservice4/nws.fdb /home/newwayservice4/nws.fbk
# END SCRIPT



A .fbk file is a special Firebird backup file format. To be able to restore a database from a .fbk file, you must obligatory restore the file using the Firebird gbak utility.

For more information about the gbak utility, refer to the Firebird documentation. For more information about script files, refer to your operating system documentation.

Once you backed-up your database, we recommend you to store a copy of your backup file on tape or other media. For further information on tape or other media to use for storage, ask your computer's sales representative.


Status
Information



© 1996-2012 OroLogic Inc.