BACKUP LOCATION

This XDB Server utility command copies the entire contents of an XDB Server location to the specified drive and path while the XDB Server location is still generally available.
Restriction: This topic applies to Windows environments only.

Invocation

BACKUP LOCATION can be executed interactively, embedded in a host language, or dynamically prepared.

Authorization

To use the BACKUP LOCATION command you must be a super user.

Syntax

BACKUP LOCATION location-name TO path-name
[INCREMENTAL]

Parameters:

location-name Identifies the location to be backed up.
path-name Specifies the parent target directory where backups are stored. Inside this directory, a subdirectory will be created that contains this backup’s contents. This subdirectory’s name is of the form xdbYYYYMMDDHHMMSSnnnnnn, where YYYYMMDDHHMMSS is the time of the backup, and nnnnnn is a relative sequence number.
INCREMENTAL Indicates that you want to backup only your log files. Omitting this option results in your log files and your location’s database files being backed up.

Description

The BACKUP LOCATION command is used for backing up locations (including all associated databases, tables, catalog tables, and log files) to a secure device, such as a file server, or a different disk drive.

This is useful for avoiding losses due to media or machine failure. For instance, if the drive where your XDB location was located becomes inoperable, provided that you have issued a BACKUP LOCATION command that saved the entire contents of that location to another disk you can ROLLFORWARD that backup to recreate the corrupted location.

While the standard BACKUP LOCATION command copies both database and log files, in addition to creating a recovery script (xdbdata.bat), a BACKUP LOCATION INCREMENTAL backs up only the log files for your location.

After performing a standard backup (which is mandatory for all recovery scenarios), which type of backup you perform is up to you. Always performing standard backups takes longer than performing incremental backups but the recovery process from them is much easier and quicker. Performing incremental backups is quicker than performing standard backups but more ROLLFORWARD steps might be necessary to recreate your location.

Examples:

BACKUP LOCATION (Standard)
The following command creates a directory, such as d:\backuplocs\xdb20051017151315000001, that contains an xdbdata.bat script, database files and log files:
BACKUP LOCATION MYLOC TO D:\BACKUPLOCS
BACKUP LOCATION (Incremental)
The following command creates a directory, such as d:\backuplocs\xdb20051017151315000002, that contains only log files:
BACKUP LOCATION MYLOC TO D:\BACKUPLOCS INCREMENTAL
Recovery with Standard Backups
The following sequence of events shows the typical steps in performing standard backups and subsequently recovering from a media failure:
  1. On Friday afternoon perform a standard backup using the following command:
    BACKUP LOCATION MYLOC TO D:\BACKUPLOCS
  2. On Monday afternoon perform a standard backup using the following command:
    BACKUP LOCATION MYLOC TO D:\BACKUPLOCS
  3. On Tuesday afternoon perform a standard backup using the following command:
    BACKUP LOCATION MYLOC TO D:\BACKUPLOCS
  4. On Wednesday morning recover from a media failure using the following steps:
    1. Stop the XDB Server.
    2. Copy the contents of the current logs to another directory, such as d:\currlocs.
    3. Remove the contents of the original XDB location.
    4. Run the xdbdata.bat script in Tuesday afternoon’s d:\backuplocs subdirectory.
    5. Start the XDB Server in exclusive use mode.
    6. Issue the following ROLLFORWARD command:
      ROLLFORWARD MYLOC USING D:\CURRLOGS
    7. Stop the XDB Server.
    8. Restart the XDB Server for general availability.
Recovery with Incremental Backups
The following sequence of events shows the typical steps in performing incremental backups and subsequently recovering from a media failure:
  1. On Friday afternoon perform a standard backup using the following command:
    BACKUP LOCATION MYLOC TO D:\BACKUPLOCS
  2. On Monday afternoon perform an incremental backup using the following command:
    BACKUP LOCATION MYLOC TO D:\BACKUPLOCS INCREMENTAL

    This creates directory xdb20051015153015000002, for instance.

  3. On Tuesday afternoon perform an incremental backup using the following command:
    BACKUP LOCATION MYLOC TO D:\BACKUPLOCS INCREMENTAL

    This creates directory xdb20051016144416000003, for instance.

  4. On Wednesday morning recover from a media failure using the following steps:
    1. Stop the XDB Server.
    2. Copy the contents of the current logs to another directory, such as d:\currlocs.
    3. Remove the contents of the original XDB location.
    4. Run the xdbdata.bat script in Friday afternoon’s d:\backuplocs subdirectory.
    5. Start the XDB Server in exclusive use mode.
    6. Issue the following ROLLFORWARD commands:
      ROLLFORWARD MYLOC USING D:\BACKUPLOCS\XDB20051015153015000002
      ROLLFORWARD MYLOC USING D:\BACKUPLOCS\XDB20051016144416000003
      ROLLFORWARD MYLOC USING D:\CURRLOGS
    7. Stop the XDB Server.
    8. Restart the XDB Server for general availability.