Schedule Database Backup

Top  Previous  Next

Note: the remote database features described in this section are for the Enterprise Edition only. The Standard Edition does not have the remote database feature available.

 

You can set an automated schedule for backing up a server based database every day using the Windows Scheduled Tasks utility. For convenience, batch files are included in the Firebird bin directory to create the scheduled tasks and to backup the database.

 

Automatic Configuration of the Scheduled Tasks


Use these steps to create a Windows scheduled task on your server to automatically backup your database.

 

1.Locate the batch file on your server at: *C:\Program Files\Firebird\KZFirebird\bin\ScheduleAMBackup.bat
2.Double-click the batch file to run it. If you get an Access Denied message, right-click on the file and choose "Run as Administrator".

 

*The Firebird directory may be in the "Program Files" or "Program Files (x86)" directory.

 If the batch file does not exist on your server, perform the manual configuration described in the next section.

 

Important: Run the scheduled task to test it as described below the next section and confirm that the database backup file is created as expected.

 

Manual Configuration of the Scheduled Tasks


Follow these steps to configure the scheduled task manually only if your installation does not contain the "BackupAssetManager.bat" file, or the automatic configuration was not successful. If your scheduled task has already been created, skip to the next section to test it.

 

1.Download the backup batch file - right-click on the link below and select "Save Target As" or "Save Link As".
Batch File: Backup Asset Manager
2.Save the file to the Firebird bin directory at: C:\Program Files\Firebird\KZFirebird\bin
The batch file must be located in the bin directory which contains the gbak utility.

 

Windows 2008/2012/2016:

 

In Windows, go to Start --> All Programs --> Accessories --> System Tools --> Task Scheduler

- or - Start --> Run --> control.exe schedtasks

Click the "Create Task" link in the Actions pane on the right side of the window, and then set the following:

 

General Tab:

Enter a Name: Backup Asset Manager

Enter a description: Backup the Asset Manager database

Select "Run whether user is logged on or not"

 

Triggers Tab:

Add a new trigger to run the task Daily.

 

Action Tab:

Add a new Action to "Start a program".

Select the BackupAssetManager.bat file which you have previously saved in the KZFirebird\bin directory.

 

Windows 2000/2003:

 

1.In Windows, go to Start --> All Programs --> Accessories --> System Tools --> Scheduled Tasks
- or - Start --> Run --> control.exe schedtasks
2.Click "Add a scheduled task"
3.Click "Next"
4.Click "Browse..." and then select the batch file you downloaded in Step 1.
5.Select the radio button to perform this task "Daily"
6.Click "Next"
7.Select a start time and then click the "Next" button.
8.Enter the user name and password for the Windows account which will be used to execute the task, and then click the "Next" button.
9.Click the "Finish" button.

 

Important: Run the scheduled task to test it as described below and confirm that the database backup file is created as expected.

 

Run the scheduled task and confirm the operation.


In Windows, go to Start --> All Programs --> Accessories --> System Tools --> Task Scheduler

- or - Start --> Run --> control.exe schedtasks

Right-click on the scheduled task you created and select "Run".
A console window will open and execute the command automatically before closing.
After the window closes, confirm that a backup file has been created in the folder at C:\Backup.
The backup file will be compressed, and may be much smaller than the uncompressed database file.
If the backup file is not created, open the batch file in Notepad, and confirm/update the file path to the gbak utility if needed.
When finished, log off the computer and allow the backup task to run at it's scheduled time, and then confirm that a new file has been created when the task ran as scheduled.
After you have confirmed that the backup file is being created as expected, be sure to update your organization's disaster recovery preparedness procedures to include the system information. A good plan will include a schedule to periodically audit the process and test a database recovery on a separate test system.

 

More information about the batch file


By default, the batch file will keep the 10 most recent backups of your database.
On the 11th day, the oldest backup file will be replaced with the current backup file.
Backup files are named using the database name plus a number at the end.  The most recent backup file ends with the number 1.  The oldest backup file ends with the number 10.
The default backup location is at C:\Backup.
The default number of copies to keep and the default backup location may be changed by editing the batch file in Notepad.
Right click on the batch file and select "Edit" to make changes.
Change only the values listed in the SET statements at the top of the batch file.
Make only one change at a time, and test between each change to aid troubleshooting if necessary.