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 one of two things:
- A Db2® ACS API driver for your storage device. For a list of supported storage hardware for the integrated driver, refer to this tech note.
- For storage devices that are not supported, implement a custom script that allows your storage device to perform snapshot operations.
Before you can perform a snapshot backup, you must enable Db2 Advanced Copy Services (ACS).
Restrictions
You cannot recover individual table spaces by using snapshot backups.
If you use integrated snapshot backups, you cannot perform a redirected restore. A FlashCopy® restore reverts the complete set of volume groups containing all database paths to a prior point in time.
Procedure
To perform a snapshot backup, use one of the following
approaches:
Issue the BACKUP DATABASE command with the USE SNAPSHOT parameter, as shown in the following example:
db2 backup db sample use snapshot
- Call the ADMIN_CMD procedure with BACKUP DB and USE
SNAPSHOT parameters, as shown in the following example:
CALL SYSPROC.ADMIN_CMD ('backup db sample use snapshot')
- Issue the db2Backup API with the SQLU_SNAPSHOT_MEDIA media
type, as shown in the following example:
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; }