Step 5: Setting Up Database Backups (PC)

For reference, the list of steps are:

  1. the installation of the PostGres SQL server
  2. installing the demo database and the main TheatreManager User
  3. install Theatre Manager and connect to the database
  4. configuration of the server parameters for a production database
  5. creating a daily backup job in Windows Task Scheduler to run the backup

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.

You can also do a manual backup at any time by double clicking on the 'TMBackup.bat' file mentioned in this section - again, even if Theatre Manager is running.

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.

1.

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.)
2.

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.

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

change the line

set DATABASE_NAME=TheatreManager

to be

set DATABASE_NAME=xxxxx

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.

edit

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

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

normally, these are not changed

edit2
Close the batch file and save the changes.  
3.

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)

backuprun

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.

backuplist

4

If you entered a password ot 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 127.0.0.1/32. 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

 

1.

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.

scheduledTask

2.

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

Click the 'Add Scheduled Task' icon.

This will start the Scheduled Task Wizard.

addTask
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'

PickApplicaiton

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

Daily is suggested, then click 'Next'

Scheduel

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

Then Click Next

RunTime

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

RunTime

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

RunTime
Note: 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.