Restoring from a snapshot backup uses the fast copying technology of a storage device to perform the data copying portion of the restore.
To perform snapshot backup and restore operations, you need 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.
You must perform a snapshot backup before you can restore from a snapshot backup. See: Performing a snapshot backup.
db2 restore db sample use snapshot
int sampleRestoreFunction( char dbAlias[],
char restoredDbAlias[],
char user[],
char pswd[],
char workingPath[] )
{
db2MediaListStruct mediaListStruct = { 0 };
rmediaListStruct.locations = &workingPath;
rmediaListStruct.numLocations = 1;
rmediaListStruct.locationType = SQLU_SNAPSHOT_MEDIA;
db2RestoreStruct restoreStruct = { 0 };
restoreStruct.piSourceDBAlias = dbAlias;
restoreStruct.piTargetDBAlias = restoredDbAlias;
restoreStruct.piMediaList = &mediaListStruct;
restoreStruct.piUsername = user;
restoreStruct.piPassword = pswd;
restoreStruct.iCallerAction = DB2RESTORE_STORDEF_NOINTERRUPT;
struct sqlca sqlca = { 0 };
db2Restore(db2Version900, &restoreStruct, &sqlca);
return 0;
}