BEGIN BACKUP

Begins an online backup.

SYNTAX

DESCRIPTION

The BEGIN BACKUP command places a database in a special state that allows you to back up all files without requiring other users to disconnect and without shutting down the database. To execute the BEGIN BACKUP command, you must have DBA or SYSADM security privileges.

Media failure is the failure of the online secondary or auxiliary storage of a computer system. The most common secondary and auxiliary storage devices are hard disks. Media failures are usually caused by physical trauma to the disk itself, such as: head crash, fire, earthquake, or exposure to vibration or g-forces outside its physical operating limits.

When a media failure occurs, one or more files can be physically damaged as a result of the failure. There is nothing that can prevent the loss of data in the damaged files, but the database can be successfully restored if the database provides archiving or backup capability. This allows you to create a backup of your database files at periodic intervals, which you can use to restore the database in the event of a media failure. There are several different types of backups, as explained below.

An online backup is any backup that can be performed while a database is running. The Database Administrator does not have to shut down the database, and users do not need to disconnect. Online backups are more convenient for users, since no action is required on their part. A DBMS must explicitly provide the capability to back up a database online, since it is still running and still has users connected.

An offline backup is any backup that must be performed after a database has been shut down. The Database Administrator must schedule a time to shut down the database, and notify all users so they can disconnect before the shut down. Offline backups can be inconvenient for users, since they must remember to complete all active transactions and disconnect from the database. A DBMS does not need to explicitly provide the capability to back up a database offline, since you can back up the database with operating system commands after it is shut down.

A full backup is any backup that creates a copy of all data and journal files, providing a copy of the entire database system at one point in time. Because full backups archive the entire database, they require a large amount of storage space, but you can restore the database fairly quickly.

An incremental backup is any backup that creates a copy of only the journal files that have changed since the last full backup. These files provide a copy of the changes made to the database since the last full backup. Because incremental backups archive only journal files, they require only a small amount of storage space, but you need more time to restore the database.

DBMaker supports four types of backups: offline full backups, online full backups, online incremental backups, and online incremental to current backups. Before you perform either type of incremental backup, you must perform either an offline full backup or an online full backup. If you don't perform a full backup first, you may be unable to restore your database in the event of a media failure.

To perform an offline full backup, you must make sure all users are disconnected and shut down the database. If any errors occur while the database is shutting down, you may be unable to complete the backup operation or restore the database at a later time. Use operating system commands or backup utilities to back up all data, BLOB, and journal files to the backup device. Using an offline full backup, you can restore a database up to the point in time it was shut down.

To perform an online full backup, you can start the database in NON-BACKUP, BACKUP-DATA, or BACKUP-DATA-AND-BLOB mode (see page 3-56 for more information on backup modes). To begin the backup, you issue the BEGIN BACKUP command. Use operating system commands or backup utilities to back up all data and BLOB files to the backup device. After these files have been backed up, issue the END BACKUP DATAFILE command. Then use operating system command or backup utilities to back up all journal files. After these files have been backed up, issue the END BACKUP JOURNAL command to complete the backup and return the database to normal operation. Using an online full backup, you can restore a database from the point in time the END BACKUP DATAFILE command was executed to the point in time the currently active journal file was copied.

To perform an online incremental backup, you must start the database in either BACKUP-DATA or BACKUP-DATA-AND-BLOB mode (see page 3-56 for more information on backup modes). To begin the backup, you issue the BEGIN INCREMENTAL BACKUP command. DBMaker will list all journal files you need to copy and a backup ID for each file. In an online incremental backup, DBMaker will only back up journal files that have been used since the last full online backup, excluding the currently active journal file. Record the filename and backup ID of each file in a safe location; these will be used if you restore you database. Use operating system commands or backup utilities to back up the journal files in the list to the backup device. After these journal files have been backed up, issue the END BACKUP JOURNAL command to complete the backup and return the database to normal operation. Using an online incremental backup, you can restore a database from the point in time the END BACKUP DATAFILE command was executed in the previous full backup, to the point in time the last committed transaction was written to the last full journal file.

To perform an online incremental backup to current, the database must have been started in BACKUP-DATA or BACKUP-DATA-AND-BLOB mode (see page 3-56 for more information on backup modes) . To begin the backup, you issue the BEGIN INCREMENTAL BACKUP TO CURRENT command. DBMaker will list all journal files you need to copy and a backup ID for each file. In an online incremental backup to current, DBMaker will back up all journal files that have been used since the last full online backup, including the currently active journal file. Record the filename and backup ID of each file in a safe location; these will be used if you restore you database. Use operating system commands or backup utilities to back up the journal files in the list to the backup device. After these journal files have been backed up, issue the END BACKUP JOURNAL command to complete the backup and return the database to normal operation. Using an online incremental backup to current, you can restore a database from the point in time the END BACKUP DATAFILE command was executed in the previous full backup, to the point in time the currently active journal file was copied.

Only users that have read permission on the database files from the operating system can perform an offline full backup, and only users with DBA or SYSADM security privileges can perform online backups. In addition, only one user at a time can perform an online backup.
You can abort an online backup at any time by issuing the ABORT BACKUP command. (For more information, see the ABORT BACKUP command.) After this command executes, you will not be able to use the files from this backup to restore the database.

You can perform a full online backup at any time with the database in any backup mode, including NON-BACKUP mode. Incremental online backups may only be performed when the database is running in BACKUP-DATA or BACKUP-DATA-AND-BLOB mode.

Backup mode indicates the type of information DBMaker will back up during an online incremental backup. There are three backup modes: NON-BACKUP, BACKUP-DATA, and BACKUP-DATA-AND-BLOB. You can change the backup mode online or offline, using one of three different methods: offline with the DB_BMODE keyword in the dmconfig.ini configuration file, online with the iSQL SET command at the dmSQL command prompt, or online with the Server Manager utility provided with DBMaker.

NON-BACKUP mode provides no protection for any data that was inserted or updated since the last full backup. In this mode, a database cannot perform online incremental backups. A database can use the journal to fully recover from instance failure, but a media failure may result in loss of data. Journal blocks not in use by an active transaction can be reused immediately after a checkpoint, but once they are overwritten, you can only restore the database to the point in time of the last full backup.

To set the backup mode to NON-BACKUP using the DB_BMODE keyword, open the dmconfig.ini configuration file using any text editor and change the value of DB_BMODE to 0. You may use the SET BACKUP OFF command during an online full backup to set the backup mode to NON-BACKUP. This command must be executed after the BEGIN BACKUP command, but before the END BACKUP JOURNAL command, and only during an online full backup.

BACKUP-DATA mode provides protection for data (excluding BLOB data) that was added or changed since the last full backup; BLOB data is not recorded in the journal. In this mode, DBMaker can perform an online incremental backup, but since changes to BLOB data are not recorded in the journal, they are not stored in the backup journal files. Any records containing BLOB data that have been added or changed since the last full backup will have the BLOB data replaced with a NULL value. After restoring the database, you must manually update all of these records with the new BLOB data. A database can use the journal to fully recover from instance failure, and can partially recover from media failure. Although you can use the last backup to restore the database to the point in time of the media failure; any changes to BLOB data will be lost. Journal blocks not in use by an active transaction can only be reused after a checkpoint has taken place and the journal file has been backed up.

To set the backup mode to BACKUP-DATA using the DB_BMODE keyword, open the dmconfig.ini configuration file using any text editor and change the value of DB_BMODE to 1. You may use the SET DATA BACKUP ON command during an online full backup to set the backup mode to BACKUP-DATA. This command must be executed after the BEGIN BACKUP command, but before the END BACKUP JOURNAL command, and only during an online full backup.

BACKUP-DATA-AND-BLOB mode provides protection for all data (including BLOB data) that was inserted or updated since the last full backup; BLOB data is included in the journal. In this mode, DBMaker can perform an online incremental backup, and all data will be stored in the backup journal files. A database can use the journal to fully recover from instance failure, and can fully recover from disk failure. You can use the last backup to completely restore the database to the point in time of the media failure, including all BLOB data. Journal blocks not in use by an active transaction can only be reused after a checkpoint has taken place and the journal file has been backed up.

To set the backup mode to BACKUP-DATA-AND-BLOB using the DB_BMODE keyword, open the dmconfig.ini configuration file using any text editor and change the value of DB_BMODE to 2. You may use the SET BLOB BACKUP ON command during an online full backup to set the backup mode to BACKUP-DATA-AND-BLOB. This command must be executed after the BEGIN BACKUP command, but before the END BACKUP JOURNAL command, and only during an online full backup.

EXAMPLES

The following example shows the steps involved in a full online backup. To begin, you issue the BEGIN BACKUP command to notify DBMaker that a full backup is in progress. Then use operating system commands to copy all data and BLOB files to the backup location. Once the files are copied, you issue the END BACKUP DATAFILE command. Then use operating system commands to copy all journal files to the backup location. Once the files are copied, you issue the END BACKUP JOURNAL command. Following this command, the database returns to normal operation.

BEGIN BACKUP
   Copy data and BLOB files to backup location using OS commands
   Change backup mode if desired
   Abort the backup if desired
END BACKUP DATAFILE
   Copy journal files to backup location using OS commands
   Change the backup mode if desired
   Abort the backup if desired
END BACKUP JOURNAL

The following example shows the steps involved in an incremental online backup. To begin, you issue the BEGIN INCREMENTAL BACKUP command to notify DBMaker that an incremental backup is in progress. DBMaker will list all journal files that you need to copy and a backup ID for each file. Use operating system commands to copy these journal files to the backup location, and record the backup ID for use during restoration. Once the files are copied, you issue the END BACKUP JOURNAL command. Following this command, the database returns to normal operation.

BEGIN INCREMENTAL BACKUP
   Copy journal files to backup location using OS commands
   Abort the backup if desired
END BACKUP JOURNAL

The following example shows the steps involved in an incremental online backup that backs up everything to the point in time the currently active journal file is copied. To begin, you issue the BEGIN INCREMENTAL BACKUP TO CURRENT command to notify DBMaker that an incremental backup to current is in progress. DBMaker will list all journal files that you need to copy and a backup ID for each file. Use operating system commands to copy these journal files to the backup location, and record the backup ID for use during restoration. Once the files are copied, you issue the END BACKUP JOURNAL command. Following this command, the database returns to normal operation.

BEGIN INCREMENTAL BACKUP TO CURRENT
   Copy journal files to backup location using OS commands
   Abort the backup if desired
END BACKUP JOURNAL

RELATED COMMANDS

< ALTER TRIGGER REPLACE | Contents | BEGIN WORK >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.