You are here

Step 4: Database Backups

Subscribe to Syndicate
Once the database is set up, you will need to establish a back up frequency that is appropriate for your venue. Mostly, setting up one backup daily to the backup directory should be enough and let it run late at night.

However, it is perfectly ok to repeat the steps below and set up 2 or more backups daily while Theatre Manager is running. You may wish to do this on a high volume site and pick times like 8:00am, 1:30pm and 8:00 pm, for example. Backups can run while Theatre Manager is being used.

Manual Backup

You can also do a manual backup at any time by double clicking on the 'BackupTM.bat' file mentioned in this section - again, even if Theatre Manager is running. It is generally found in the C:\BoxOffice folder, although it may be on another drive on the database server. The location of this file is where you placed it using the instructions on the rest of this page.

This backup process only exports data from the database and creates a compressed backup file. You will need to take those backups and copy them to another machine and/or establish a backup rotation and take some offsite.


If you used the installer to place files into the correct location, you can skip to step 2 in this section. If you did not, then you will need a copy of two files and then:

  1. Create a directory called C:\BoxOffice (or on D: or E: .. as appropriate)
  2. Create a directory called C:\BoxOffice\Backups (or on D: etc.)
  3. Get a copy of the files backupTM.bat and realdate an place them into the C:\Boxoffice directory (or D: etc.)

If the files are in the correct place, then we will need to edit the BackupTM.bat file. Note, if you have multiple databases to backup, make a one copy of this file for each database you want to backup and edit accordingly.

Navigate to the C:\BoxOffice directory and find the 'BackupTM.bat file.

Right click on the file and edit with WordPad or NotePad. edit

change the line

set DATABASE_NAME=TheatreManager
to be

where xxxxx is the name of the customer database set up in postgres.

Note that the name of the database is case sensitive and must match what is seen in PGAdmin III, or what you used to log on to the database.

If you altered the install location of Postgres or the box office directory, change the drive mappings in the two lines that are highlighted. edit2

Set POSTGRESQL_PATH=C: ..... to D:
set BOXOFFICE_DIR=C:\ .... to D: etc

normally, these are not changed

Close the batch file and save the changes.  

BackupTM.bat uses robocopy to make a month-end copy to a separate directory. This is part of windows 7 and up. If you are using server 2003, you can Download Windows Resource Kit Tools for Server 2003 to get robocopy.

Test the batch file by double clicking on the TMBackup.bat to see that it runs. You may be asked for a password. if so, enter it and you should see a bunch of feedback as the database is backed up. If you do have to enter a password, refer to #4 (below)


When done and the DOS window closes, go to the C:\BoxOffice\Backups directory and see if there is a recent backup for your database. Note that there shold be some size to the database backup.. is should not be zero bytes. In this sample, we have the original demo and a backup made on 20070913 at 12:40:04 in the afternoon. There will be a new file here each time the backup is run.



If you entered a password to make the backups run, then you need to tell the postgres to allow 'Trust' permissions for the local machine so that backups will run un-aided.

On XP, you may just need to provide trust access to On Vista, you may need to provide 'trust' access to ::1/128 as well. Refer to the section on editing the pg_hba.conf. file

Creating a Daily backup Job


Create a timed backup for the database by going to Start->Settings->Control Panels->Scheduled Tasks.

Only do this on the machine that has the database server on it.

If you are using vista or do not have a 'classic' view of the task scheduler, then you may wish to change the control panel view to 'classic' mode. Somehow, this just seems easier to find things.



Double click on the Scheduled Task icon to begin the setup process

Click the 'Add Scheduled Task' icon.

This will start the Scheduled Task Wizard.

Click Next wizard1
On the list of applications, click the 'Browse' button. wizard2

On the 'Select Program to Schedule' dialog, navigate to the C:\BoxOffice folder and click on the 'BackupTM' icon.

Then click 'Open'


You will then have the ability to pick a frequency for the backup.

Daily is suggested, then click 'Next'


Pick the time that you want the backup to run. 2:00 am is as good a time as any.

Then Click Next


Enter the password for the administrator of the machine. Note that this is not the same as the password for the postgres user

Then Click Next


Click 'Finish' to save the job. There is no need to go to the advanced properties.

Run with highest Privileges. If the task is created in Windows 7 or Windows Server 2008 the Wizard will be slightly different. When creating the Schedule Task on these platforms the option for Run With Highest Privileges must be checked to ensure the database is updated with the backup size and the vacuum process runs.


If you want a log If you would like to have the output of the backup file from the task scheduler go to a log file, then you can set the command to be:

cmd /c C:\Backups\backupTM.bat > c:\backupLog.txt

you can schedule backupTM to run as many times as you want during the day by creating more jobs.

Once is normally enough but you may feel that more times is better for your backup requirements.