DB2 Version 9.7 for Linux, UNIX, and Windows

Performing a snapshot backup

A snapshot backup operation uses the fast copying technology of a storage device to perform the data copying portion of the backup.

Before you begin

To perform snapshot backup and restore operations, you need a DB2® ACS API driver for your storage device. Integrated into IBM® Data Server is a DB2 ACS API driver for the following storage hardware:

Before you can perform a snapshot backup, you must enable DB2 Advanced Copy Services (ACS). See: Enabling DB2 Advanced Copy Services (ACS).

Procedure

You can perform a snapshot backup using the BACKUP DATABASE command with the USE SNAPSHOT parameter, the db2Backup API with the SQLU_SNAPSHOT_MEDIA media type, or the ADMIN_CMD procedure with the BACKUP DATABASE and the USE SNAPSHOT parameters:

BACKUP DATABASE command:

db2 backup db sample use snapshot

ADMIN_CMD procedure with BACKUP DATABASE parameter:

CALL SYSPROC.ADMIN_CMD
   ('backup db sample use snapshot')

db2Backup API

int sampleBackupFunction( char dbAlias[],
                          char user[],
                          char pswd[],
                          char workingPath[] )
{
  db2MediaListStruct mediaListStruct = { 0 };

  mediaListStruct.locations = &workingPath;
  mediaListStruct.numLocations = 1;
  mediaListStruct.locationType = SQLU_SNAPSHOT_MEDIA;


  db2BackupStruct backupStruct = { 0 };

  backupStruct.piDBAlias = dbAlias;
  backupStruct.piUsername = user;
  backupStruct.piPassword = pswd;
  backupStruct.piVendorOptions = NULL;
  backupStruct.piMediaList = &mediaListStruct;

  db2Backup(db2Version950, &backupStruct, &sqlca);

  return 0;
}

Results

After performing a snapshot backup, you can restore from the snapshot backup.