14.3. Backup

This tab is in the Database tab.

14.3.1. Creating Backups

The Backup tab allows you to set up one or more backup directory locations, then to easily create a backup of the database to one of those locations.

To set up the first backup directory, enter the desired directory location into the "Snapshot Directory 0" field in the Backup tab. You may use the Browse button to help you find an appropriate directory.

Press the "Text Snapshot" button to produce a JRaceman export file in the backup directory. This creates a file with the same contents as would be created if you used the "Export Standard Data to JRaceman Data File" command in the Database menu, but it automatically generates a file name based on the date and time of the backup. Thus you can come back and press the button again, and it will create another backup file with a new name. The old backup files remain in the backup directory until you delete them (using your regular file system tools). You can have as many backup files as you have space on your disk.

The "Mckoi Snapshot" button works similarly to the "Text Snapshot" button, except that it creates a complete database directory, rather than a text file, in the backup directory. As with "Text Snapshot", the directory name is based on the date and time of the backup, so you can create multiple backups without overwriting the old backups. A Mckoi backup directory takes quite a bit more space than a text backup file, so you may want to be more conservative in how often you create them. The old Mckoi backup directories remain in the backup directory until you delete them (using your regular file system tools).

Note that the Mckoi backup is done by the database server, not by the client, so you will not be able to use the Mckoi Snapshot button from a client machine when running in client/server mode.

You can mix Text backups and Mckoi backups in the same backup directory. Text backups use the extension ".txt"; Mckoi backups use the extension ".db".

The second backup directory and set of buttons work just like the first. They are there to allow you to have two different backup directories. For example, you might put those backup directories onto two different machines.

14.3.2. The Quick Backup Button

The Backup button in the menu bar provides an easy and quick way to backup your database. Backup files are small, so you can (and should) backup often.

Set the directory into which quick backups are generated by using the Context Options tab to set the value of the option "Backup.directory" to the direction in which you want to save your backups. As a Contex Option, you can set this on a per-host basis so that every client can back up to a local directory. If no Backup.directory option is found, the quick backup button uses Snapshot Directory 0.

14.3.3. Recovering A Backup

In the event that you have a crash that corrupts your database, and the repair procedure is unable to recover the data to your satisfaction, or if you have accidentally deleted a large amount of data, you will have to use a backup file.

In the case of a corrupted database, before using a backup file you can try running the repair tool by using the -repair command line options, as in this command:

	  java -jar jraceman.jar -repair
        

This runs the Mckoi repair tool, which attempts to repair corruption in the database. Make sure that you are not running a database server or any other program that accesses the database when you run the repair tool.

To recover using a Text backup file, rename the old database folder (the default name is jracedb, and the path is normally displayed in the splash screen as JRaceman starts) to another name, then rerun JRaceman to create a new database. Do not import a sport definition file; when it asks you about that, cancel. From the Database menu, select the "Import JRaceman Data File" command and specify the backup file from which to read. The backup filenames encode the date and time they were made, with the year first and the seconds last. This means the oldest file will normally sort to the beginning, and the newest will normally sort to the end. You will probably want to use the newest file. When the import finishes, you are ready to go.

To recover using a Mckoi backup, rename the old database folder to another name, and copy the selected Mckoi backup folder (one with the name that starts with the year) to the database folder location that you just vacated. Restart JRaceman - it should read the new database and be ready to go. As with the Text backup files, the Mckoi backup directory names encode the date and time of the backup, and will normally sort with the oldest first and the newest last.

If you want to look at the data in a Mckoi backup, you can directly run JRaceman on that backup database using the -db command line option, such as in this command:

	  java -jar jraceman.jar -db /usr/jraceman-backups/2003-06-26-09-48-42.db
        

Any changes you make to this backup database will be stored in the backup database, but will not affect the main database or the other backup databases.