Customizing the Data Source back up procedure

<< Click to Display Table of Contents >>

Navigation:  Data Sources > Back ups >

Customizing the Data Source back up procedure

Previous pageReturn to chapter overviewNext page

Back up is performed by executing the SQL BACKUP command contained in the file backup.sql. You can customize the back up procedure by modifying the BACKUP command contained in the file.

 

The contents of the backup.sql file that ships with Dispatch is as follows:

 

BACKUP DATABASE DIRECTORY %d TRANSACTION LOG RENAME

 

The %d indicates that the backup should be saved to a folder named backup in the folder that contains the current database file. For a standard installation where the database file is contained in the folder C:\ASA80\dsptch15, the backup file would be created in the folder C:\ASA80\dsptch15\backup.

 

The full syntax of the BACKUP command is as follows:

 

Syntax 1

BACKUP DATABASE

DIRECTORY backup-directory

[ WAIT BEFORE START ]

[ WAIT AFTER END ]

[ DBFILE ONLY ]

[ TRANSACTION LOG ONLY ]

[ TRANSACTION LOG RENAME [ MATCH ] ]

[ TRANSACTION LOG TRUNCATE ]

 

Syntax 2

BACKUP DATABASE TO archive-root

[ ATTENDED { ON | OFF } ]

[ WITH COMMENT comment string ]

 

 

Parameter

Description

backup-directory

The target location on disk for the backup files, relative to the server's current directory at startup. If the directory does not already exist, it is created. Specifying an empty string as a directory allows you to rename or truncate the log without making a copy of it first.

 

The backslash ( \ ) is an escape character in SQL strings, so each backslash must be doubled.

 

You can use %d or %s in place of a fixed directory location. See the examples below.

WAIT BEFORE START

This clause ensures that the backup copy of the database does not contain any information required for recovery. In particular, it ensures that the rollback log for each connection is empty.

 

If a backup is carried out using this clause, you can start the backup copy of the database in read-only mode and validate it. By enabling validation of the backup database, the customer can avoid making an additional copy of the database.

WAIT AFTER END

This clause may be used if the transaction log is being renamed or truncated. It ensures that all transactions are completed before the log is renamed or truncated. If this clause is used, the backup must wait for other connections to commit or rollback any open transactions before finishing.

MATCH keyword

If you supply the MATCH keyword, the backup copy of the transaction log is given a name of the form YYMMDDnn.log. This enables the same statement to be executed several times without writing over old data.

archive-root

The file name or tape drive device name for the archive file.

 

To back up to tape, you must specify the device name of the tape drive. For example, on Windows NT or NetWare, the first tape drive is \\.\tape0.

 

The backslash ( \ ) is an escape character in SQL strings, so each backslash must be doubled.

 

You can use %s in place of an archive location. See the examples below.

WITH COMMENT

Record a comment in the archive file and in the backup history file.

ATTENDED

The clause applies only when backing up to a tape device. ATTENDED ON (the default) indicates that someone is available to monitor the status of the tape drive and to place a new tape in the drive when needed. A message is sent to the application that issued the BACKUP statement if the tape drive requires intervention. The database server then waits for the drive to become ready. This may happen, for example, when a new tape is required.

 

If ATTENDED OFF is specified and a new tape is required or the drive is not ready, no message is sent, and an error is given.

 

Each BACKUP operation, whether image or archive, updates a history file called backup.syb. This file is stored in the same directory as the database server executable.

 

Examples

 

Back up the current database and the transaction log to a file, renaming the existing transaction log. An image backup is created.

 

BACKUP DATABASE

DIRECTORY 'd:\\temp\\backup'

TRANSACTION LOG RENAME

 

The option to rename the transaction log is useful especially in replication environments, where the old transaction log is still required.

 

Back up the current database and transaction log to tape:

 

BACKUP DATABASE

TO '\\\\.\\tape0'

 

Back up the database to the folder backup in the same folder that contains the current database file. The %d indicates that the backup should be saved to a folder named backup in the folder that contains the current database file. For a standard installation where the database is located in the folder C:\ASA80\dsptch15,  the backup file would be created in the folder C:\ASA80\dsptch15\backup.

 

BACKUP DATABASE

DIRECTORY %d

TRANSACTION LOG RENAME

 

Back up the database to a folder selected by the user. The %s indicates that the user should be prompted to select the destination folder.

 

BACKUP DATABASE

DIRECTORY %s

TRANSACTION LOG RENAME