DB2 10.5 for Linux, UNIX, and Windows

db2Restore API - Restore a database or table space

Recreates a damaged or corrupted database that has been backed up using the db2Backup API. The restored database is in the same state it was in when the backup copy was made.

This utility can also:
  • Restore to a database with a name different from the database name in the backup image (in addition to being able to restore to a new database), the exception being a snapshot restore where the backup image database name must be the same.
  • Restore DB2® databases that were created in the two previous releases.
  • Restore from a table space level backup, or restore table spaces from within a database backup image.
  • Transport a set of table spaces and schemas from database backup image to a database (starting in DB2 Version 9.7 Fix Pack 2).

Scope

This API only affects the database partition from which it is called.

Authorization

To restore to an existing database, one of the following authorities:

To restore to a new database, one of the following authorities:

If you specify a user name, you require CONNECT authority on the database.

Required connection

Database, to restore to an existing database. This API automatically establishes an exclusive connection to the specified database and will release the connection when the restore operation finishes.

Instance and database, to restore to a new database. The instance attachment is required to create the database.

For snapshot restore, instance and database connections are required.

To restore to a new database at an instance different from the current instance (as defined by the value of the DB2INSTANCE environment variable), it is necessary to first attach to the instance where the new database will reside.

API include file

db2ApiDf.h

API and data structure syntax

SQL_API_RC SQL_API_FN
  db2Restore (
       db2Uint32 versionNumber,
       void * pDB2RestoreStruct,
       struct sqlca * pSqlca);

typedef SQL_STRUCTURE db2RestoreStruct
{
  char *piSourceDBAlias;
  char *piTargetDBAlias;
  char oApplicationId[SQLU_APPLID_LEN+1];
  char *piTimestamp;
  char *piTargetDBPath;
  char *piReportFile;
  struct db2TablespaceStruct *piTablespaceList;
  struct db2MediaListStruct *piMediaList;
  char *piUsername;
  char *piPassword;
  char *piNewLogPath;
  void *piVendorOptions;
  db2Uint32 iVendorOptionsSize;
  db2Uint32 iParallelism;
  db2Uint32 iBufferSize;
  db2Uint32 iNumBuffers;
  db2Uint32 iCallerAction;
  db2Uint32 iOptions;
  char *piComprLibrary;
  void *piComprOptions;
  db2Uint32 iComprOptionsSize;
  char *piLogTarget;
  struct db2StoragePathsStruct *piStoragePaths;
  char *piRedirectScript;
  char *piStagingDBAlias;
  struct db2SchemaStruct *piSchemaList;
  char *piStogroup;
  char *piEncrLibrary;
  void *piEncrOptions;
  db2Uint32 iEncrOptionsSize;  struct sqleDbEncryptionOptions *piDbEncOpts;
} db2RestoreStruct;

typedef SQL_STRUCTURE db2TablespaceStruct
{
  char                        **tablespaces;
  db2Uint32 numTablespaces;
} db2TablespaceStruct;

typedef SQL_STRUCTURE db2MediaListStruct
{
  char                        **locations;
  db2Uint32 numLocations;
  char locationType;
} db2MediaListStruct;

typedef SQL_STRUCTURE db2StoragePathsStruct
{
  char                        **storagePaths;
  db2Uint32 numStoragePaths;
} db2StoragePathsStruct;

SQL_API_RC SQL_API_FN
  db2gRestore (
       db2Uint32 versionNumber,
       void * pDB2gRestoreStruct,
       struct sqlca * pSqlca);

typedef SQL_STRUCTURE db2gRestoreStruct
{
  char *piSourceDBAlias;
  db2Uint32 iSourceDBAliasLen;
  char *piTargetDBAlias;
  db2Uint32 iTargetDBAliasLen;
  char *poApplicationId;
  db2Uint32 iApplicationIdLen;
  char *piTimestamp;
  db2Uint32 iTimestampLen;
  char *piTargetDBPath;
  db2Uint32 iTargetDBPathLen;
  char *piReportFile;
  db2Uint32 iReportFileLen;
  struct db2gTablespaceStruct *piTablespaceList;
  struct db2gMediaListStruct *piMediaList;
  char *piUsername;
  db2Uint32 iUsernameLen;
  char *piPassword;
  db2Uint32 iPasswordLen;
  char *piNewLogPath;
  db2Uint32 iNewLogPathLen;
  void *piVendorOptions;
  db2Uint32 iVendorOptionsSize;
  db2Uint32 iParallelism;
  db2Uint32 iBufferSize;
  db2Uint32 iNumBuffers;
  db2Uint32 iCallerAction;
  db2Uint32 iOptions;
  char *piComprLibrary;
  db2Uint32 iComprLibraryLen;
  void *piComprOptions;
  db2Uint32 iComprOptionsSize;
  char *piLogTarget;
  db2Uint32 iLogTargetLen;
  struct db2gStoragePathsStruct *piStoragePaths;
  char *piRedirectScript;
  db2Uint32 iRedirectScriptLen;
  struct db2gSchemaStruct *piSchemaList;
  char *piStagingDBAlias;
  db2Uint32 iStagingDBAliasLen;
  char *piStogroup;
  db2Uint32 iStogroupLen;
  char *piEncrLibrary;
  db2Uint32 iEncrLibraryLen;
  void *piEncrOptions;
  db2Uint32 iEncrOptionsSize;  struct sqleDbEncryptionOptions *piDbEncOpts;
} db2gRestoreStruct;

typedef SQL_STRUCTURE db2gTablespaceStruct
{
  struct db2Char *tablespaces;
  db2Uint32 numTablespaces;
} db2gTablespaceStruct;

typedef SQL_STRUCTURE db2gMediaListStruct
{
  struct db2Char *locations;
  db2Uint32 numLocations;
  char locationType;
} db2gMediaListStruct;

typedef SQL_STRUCTURE db2gStoragePathsStruct
{
  struct db2Char *storagePaths;
  db2Uint32 numStoragePaths;
} db2gStoragePathsStruct;

typedef SQL_STRUCTURE db2Char
{
   char *pioData;
   db2Uint32 iLength;
   db2Uint32 oLength;
} db2Char;

db2Restore API parameters

versionNumber
Input. Specifies the version and release level of the structure passed as the second parameter pDB2RestoreStruct.
pDB2RestoreStruct
Input. A pointer to the db2RestoreStruct structure.
pSqlca
Output. A pointer to the sqlca structure.

db2RestoreStruct data structure parameters

piSourceDBAlias
Input. A string containing the database alias of the source database backup image.
piTargetDBAlias
Input. A string containing the target database alias. If this parameter is null, the value of the piSourceDBAlias parameter will be used.
piStagingDBAlias
Input. A string containing the staging database name to be used with the TRANSPORT option. If this parameter is NULL the staging database name will be internally generated and the database will be dropped after transport completes. If a name is provided the staging database will not be dropped.
oApplicationId
Output. The API will return a string identifying the agent servicing the application. Can be used to obtain information about the progress of the backup operation using the database monitor.
piTimestamp
Input. A string representing the time stamp of the backup image. This field is optional if there is only one backup image in the source specified.
piTargetDBPath
Input. A string containing the relative or fully qualified name of the target database directory on the server. Used if a new database is to be created for the restored backup; otherwise not used.
piReportFile
Input. The file name, if specified, must be fully qualified.
Note: This parameter is obsolete, but still defined.
piTablespaceList
Input. List of table spaces to be restored. Used when restoring a subset of table spaces from a database or table space backup image. For rebuild cases, this can be an include list or exclude list of table spaces used to rebuild your database. See the DB2TablespaceStruct structure. The following restrictions apply:
  • The database must be recoverable (for non-rebuild cases only); that is, log retain or user exits must be enabled.
  • The database being restored to must be the same database that was used to create the backup image. That is, table spaces can not be added to a database through the table space restore function.
  • The rollforward utility will ensure that table spaces restored in a partitioned database environment are synchronized with any other database partition containing the same table spaces. If a table space restore operation is requested and the piTablespaceList is NULL, the restore utility will attempt to restore all of the table spaces in the backup image.
  • When restoring a table space that has been renamed since it was backed up, the new table space name must be used in the restore command. If the old table space name is used, it will not be found.
  • In the case of rebuild, the list must be given for 3 of the 5 rebuild types: DB2RESTORE_ALL_TBSP_IN_DB_EXC, DB2RESTORE_ALL_TBSP_IN_IMG_EXC and DB2RESTORE_ALL_TBSP_IN_LIST.
piSchemaList
Input. The list of schemas to be transported. Used with piTablespaceList and to define a valid transportable set.
piMediaList
Input. Source media for the backup image.

For more information, see the db2MediaListStruct structure.

piUsername
Input. A string containing the user name to be used when attempting a connection to the database. Can be NULL.
piPassword
Input. A string containing the password to be used with the user name. Can be NULL.
piNewLogPath
Input. A string representing the path to be used for logging after the restore has completed. If this field is null the currently defined log path will be used. If the database seeds do not match the log path in the backup images, GLFH will be used instead. If the database seeds match, the log path of the GLFH currently on disk will be used.
  • DB2RESTORE_LOGTARGET_DEFAULT

    Restore log files from the backup image into the database's default log directory, for example: /home/dbuser/db2inst/NODE0000/SQL00001/LOGSTREAM0000

piVendorOptions
Input. Used to pass information from the application to the vendor functions. This data structure must be flat; that is, no level of indirection is supported. Note that byte-reversal is not done, and the code page is not checked for this data.
iVendorOptionsSize
Input. The length in bytes of the piVendorOptions parameter, which cannot exceed 65535 bytes.
iParallelism
Input. Degree of parallelism (number of buffer manipulators). Minimum is 1. Maximum is 1024.
iBufferSize
Input. Backup buffer size in 4 KB allocation units (pages). Minimum is 8 units. The size entered for a restore must be equal to or an integer multiple of the buffer size used to produce the backup image.
iNumBuffers
Input. Specifies number of restore buffers to be used.
iCallerAction
Input. Specifies action to be taken. Valid values (defined in db2ApiDf header file, located in the include directory) are:
  • DB2RESTORE_RESTORE - Start the restore operation.
  • DB2RESTORE_NOINTERRUPT - Start the restore. Specifies that the restore will run unattended, and that scenarios which normally require user intervention will either be attempted without first returning to the caller, or will generate an error. Use this caller action, for example, if it is known that all of the media required for the restore have been mounted, and utility prompts are not required.
  • DB2RESTORE_CONTINUE - Continue the restore after the user has performed some action requested by the utility (mount a new tape, for example).
  • DB2RESTORE_TERMINATE - Terminate the restore after the user has failed to perform some action requested by the utility.
  • DB2RESTORE_DEVICE_TERMINATE - Remove a particular device from the list of devices used by restore. When a particular device has exhausted its input, restore will return a warning to the caller. Call restore again with this caller action to remove the device which generated the warning from the list of devices being used.
  • DB2RESTORE_PARM_CHK - Used to validate parameters without performing a restore. This option does not terminate the database connection after the call returns. After a successful return of this call, it is expected that the user will issue another call to this API with the iCallerAction parameter set to the value DB2RESTORE_CONTINUE to continue with the restore.
  • DB2RESTORE_PARM_CHK_ONLY - Used to validate parameters without performing a restore. Before this call returns, the database connection established by this call is terminated, and no subsequent call is required.
  • DB2RESTORE_TERMINATE_INCRE - Terminate an incremental restore operation before completion.
  • DB2RESTORE_RESTORE_STORDEF - Initial call. Table space container redefinition requested.
  • DB2RESTORE_STORDEF_NOINTERRUPT - Initial call. The restore will run uninterrupted. Table space container redefinition requested.
iOptions
Input. A bitmap of restore properties. The options are to be combined using the bitwise OR operator to produce a value for iOptions. Valid values (defined in db2ApiDf header file, located in the include directory) are:
  • DB2RESTORE_OFFLINE - Perform an offline restore operation.
  • DB2RESTORE_ONLINE - Perform an online restore operation.
  • DB2RESTORE_DB - Restore all table spaces in the database. This must be run offline.
  • DB2RESTORE_TABLESPACE - Restore only the table spaces listed in the piTablespaceList parameter from the backup image. This can be online or offline.
  • DB2RESTORE_HISTORY - Restore only the history file.
  • DB2RESTORE_COMPR_LIB - Indicates that the compression library is to be restored. This option cannot be used simultaneously with any other type of restore process. If the object exists in the backup image, it will be restored into the database directory. If the object does not exist in the backup image, the restore operation will fail.
  • DB2RESTORE_LOGS - Specifies that only the set of log files contained in the backup image are to be restored. If the backup image does not include log files, the restore operation will fail. If this option is specified, the piLogTarget parameter must also be specified.
  • DB2RESTORE_INCREMENTAL - Perform a manual cumulative restore operation.
  • DB2RESTORE_AUTOMATIC - Perform an automatic cumulative (incremental) restore operation. Must be specified with DB2RESTORE_INCREMENTAL.
  • DB2RESTORE_ROLLFWD - Place the database in rollforward pending state after it has been successfully restored.
  • DB2RESTORE_NOROLLFWD - Do not place the database in rollforward pending state after it has been successfully restored. This cannot be specified for backups taken online or for table space level restores. If, following a successful restore, the database is in rollforward pending state, the db2Rollforward API must be called before the database can be used.
  • DB2RESTORE_GENERATE_SCRIPT - Create a script, that can be used to perform a redirected restore. piRedirectScript must contain a valid file name. The iCallerAction need to be either DB2RESTORE_RESTORE_STORDEF or DB2RESTORE_STORDEF_NOINTERRUPT.
  • DB2RESTORE_TRANSPORT - Transport a set of table spaces and SQL schemas. The table spaces and schemas listed in the piTablespaceList and piSchemaList parameters must define a valid transportable set (starting in DB2 Version 9.7 Fix Pack 2).

The following values should be used for rebuild operations only:

  • DB2RESTORE_ALL_TBSP_IN_DB - Restores the database with all the table spaces known to the database at the time of the image being restored. This rebuild overwrites a database if it already exists.
  • DB2RESTORE_ALL_TBSP_IN_DB_EXC - Restores the database with all the table spaces known to the database at the time of the image being restored except for those specified in the list pointed to by the piTablespaceList parameter. This rebuild overwrites a database if it already exists.
  • DB2RESTORE_ALL_TBSP_IN_IMG - Restores the database with only the table spaces in the image being restored. This rebuild overwrites a database if it already exists.
  • DB2RESTORE_ALL_TBSP_IN_IMG_EXC - Restores the database with only the table spaces in the image being restored except for those specified in the list pointed to by the piTablespaceList parameter. This rebuild overwrites a database if it already exists.
  • DB2RESTORE_ALL_TBSP_IN_LIST - Restores the database with only the table spaces specified in the list pointed to by the piTablespaceList parameter. This rebuild overwrites a database if it already exists.

NOTE: If the backup image is of a recoverable database, then WITHOUT ROLLING FORWARD (DB2RESTORE_NOROLLFWD) cannot be specified with any of the rebuild actions listed previously.

piComprLibrary
Input. Indicates the name of the external library to use to decompress the backup image if the image is compressed. The name must be a fully-qualified path that refers to a file on the server. If the value is a null pointer or a pointer to an empty string, the DB2 database system attempts to use the library stored in the image. If the backup is not compressed, the value of this parameter will be ignored. If the specified library is not found, the restore operation will fail.
piComprOptions
Input. This API parameter describes a block of binary data that will be passed to the initialization routine in the decompression library. The DB2 database system passes this string directly from the client to the server, so any issues of byte-reversal or code-page conversion must be handled by the compression library. If the first character of the data block is '@', the remainder of the data is interpreted as the name of a file residing on the server. The DB2 database system then replaces the contents of the piComprOptions and iComprOptionsSize parameters with the contents and size of this file and passes these new values to the initialization routine.
iComprOptionsSize
Input. A four-byte unsigned integer that represents the size of the block of data passed as piComprOptions. The iComprOptionsSize parameter should be zero if and only if the piComprOptions value is a null pointer.
piLogTarget
Input. Specifies the absolute path of a directory on the database server that must be used as the target directory for extracting log files from a backup image. If this parameter is specified, any log files included in the backup image are extracted into the target directory. If this parameter is not specified, log files included in the backup image are not extracted. To extract only the log files from the backup image, DB2RESTORE_LOGS value should be passed to the iOptions parameter.

For non-snapshot restores:

  • DB2RESTORE_LOGTARGET_DEFAULT

    Restore log files from the backup image into the database's default log directory, for example: /home/dbuser/db2inst/NODE0000/SQL00001/LOGSTREAM0000

For snapshot restore, one of the following must be given:
  • DB2RESTORE_LOGTARGET_INCLUDE "INCLUDE"

    Restore log directory volumes from the snapshot image. If this option is specified and the backup image contains log directories, then they will be restored. Existing log directories and log files on disk will be left intact if they do not conflict with the log directories in the backup image. If existing log directories on disk conflict with the log directories in the backup image, then an error will be returned.

  • DB2RESTORE_LOGTARGET_EXCLUDE "EXCLUDE"

    Do not restore log directory volumes. If this option is specified, then log directories will not be restored from the backup image. Existing log directories and log files on disk will be left intact if they do not conflict with the log directories in the backup image. If a path belonging to the database is restored and a log directory will implicitly be restored because of this, thus causing a log directory to be overwritten, an error will be returned.

  • DB2RESTORE_LOGTARGET_INCFORCE "INCLUDE FORCE"

    Allow existing log directories to be overwritten and replaced when restoring the snapshot image. If this option is specified and the backup image contains log directories, then they will be restored. Existing log directories and log files on disk will be left intact if they do not conflict with the log directories in the backup image. If existing log directories on disk conflict with the log directories in the backup image, then they will be overwritten by those from the backup image.

  • DB2RESTORE_LOGTARGET_EXCFORCE "EXCLUDE FORCE"

    Allow existing log directories to be overwritten and replaced when restoring the snapshot image. If this option is specified, then log directories will not be restored from the backup image. Existing log directories and log files on disk will be left intact if they do not conflict with the log directories in the backup image. If a path belonging to the database is restored and a log directory will implicitly be restored because of this, thus causing a log directory to be overwritten, the restore will go ahead and overwrite the conflicting log directory.

where DB2RESTORE_LOGTARGET_EXCLUDE is the default.
piStoragePaths
Input. A structure containing fields that describe a list of storage paths used for automatic storage. Set this to NULL if no storage groups are created.
piRedirectScript
Input. The file name for the redirect restore script that will be created on client side. The file name can be specified relative or absolute. The iOptions field need to have the DB2RESTORE_GENERATE_SCRIPT bit set.
piStogroup
Input. The name of the target storage group for all table spaces being transported. This storage group must already exist in the target database. Only valid during a schema transport operation.
piEncrLibrary
Input. Indicates the name of the external library to use to decrypt the backup image if the image is encrypted. The name must be a fully-qualified path that refers to a file on the server. If the value is a null pointer or a pointer to an empty string, the database manager attempts to use the library that is stored in the image. If the backup image is not encrypted, the value of this parameter is ignored. If the specified library is not found, the restore operation will fail. This parameter must not be set if piComprLibrary is set.
piEncrOptions
Input. Describes a block of binary data that is passed to the initialization routine in the decryption library. Because the database manager passes this string directly from the client to the server, any byte reversal or code page conversion issues must be handled by the encryption library. If the first character of the data block is '@', the rest of the data is interpreted as the name of a file that resides on the server. The database manager then replaces the values of the piEncrOptions and iEncrOptionsSize parameters with the contents and size of this file and passes these new values to the initialization routine. The piEncrOptions parameter must not be set if piComprOptions is set.
iEncrOptionsSize
Input. A four-byte unsigned integer that represents the size of the block of data that is passed as piEncrOptions. The iEncrOptionsSize parameter must be zero if the piEncrOptions value is a null pointer.
piDbEncOpts
Input. A pointer to a structure containing the encryption options that are to be used when restoring into a new database.

db2TablespaceStruct data structure specific parameters

tablespaces
Input. A pointer to the list of table spaces to be backed up. For C, the list is null-terminated strings. In the generic case, it is a list of db2Char structures.
numTablespaces
Input. Number of entries in the tablespaces parameter.

db2MediaListStruct data structure parameters

locations
Input. A pointer to the list of media locations. For C, the list is null-terminated strings. In the generic case, it is a list of db2Char structures.
numLocations
Input. The number of entries in the locations parameter.
locationType
Input. A character indicating the media type. Valid values (defined in sqlutil header file, located in the include directory) are:
SQLU_LOCAL_MEDIA: 'L'
Local devices (tapes, disks, diskettes, or named pipes).
SQLU_XBSA_MEDIA: 'X'
XBSA interface.
SQLU_TSM_MEDIA: 'A'
Tivoli® Storage Manager.
SQLU_OTHER_MEDIA: 'O'
Vendor library.
SQLU_SNAPSHOT_MEDIA: 'F'
Specifies that the data is to be restored from a plug-in library snapshot backup.
You cannot use SQLU_SNAPSHOT_MEDIA with any of the following options:
  • caller actions: DB2RESTORE_RESTORE_STORDEF, DB2RESTORE_STORDEF_NOINTERRUPT, DB2RESTORE_TERMINATE_INCRE
  • DB2RESTORE_REPLACE_HISTORY
  • DB2RESTORE_TABLESPACE
  • DB2RESTORE_COMPR_LIB
  • DB2RESTORE_INCREMENTAL
  • DB2RESTORE_HISTORY
  • DB2RESTORE_LOGS
  • piStoragePaths - it must be NULL or empty in order to use it
  • piTargetDBPath
  • piTargetDBAlias
  • piNewLogPath
  • iNumBuffers
  • iBufferSize
  • piRedirectScript
  • iRedirectScriptLen
  • iParallelism
  • piComprLibrary, iComprLibraryLen, piComprOptions, or iComprOptionsSize
  • piEncrLibrary, iEncrLibraryLen, piEncrOptions, or iEncrOptionsSize
  • numLocations field of this structure must be 1 for snapshot restore
Also, you cannot use the SNAPSHOT parameter with any restore operation that involves a table space list.

The default behavior when restoring data from a snapshot backup image will be a FULL DATABASE OFFLINE restore of all paths that make up the database including all containers, local volume directory, database path (DBPATH), primary log and mirror log paths of the most recent snapshot backup if no timestamp is provided (INCLUDE LOGS is the default for all snapshot backups unless EXCLUDE LOGS is explicitly stated). If a timestamp is provided then that snapshot backup image will be restored.

Integrated into IBM® Data Server is a DB2 ACS API driver for the following storage hardware:
  • IBM TotalStorage SAN Volume Controller
  • IBM Enterprise Storage Server® Model 800
  • IBM Storwize V7000
  • IBM System Storage® DS6000™
  • IBM System Storage DS8000®
  • IBM System Storage N Series
  • IBM XIV
SQLU_SNAPSHOT_SCRIPT_MEDIA: 'f'
Specifies that the data is to be restored from a scripted snapshot backup.

db2StoragePathsStruct data structure parameters

storagePaths
Input. An array of strings containing fully qualified names of storage paths on the server that will be used for automatic storage table spaces. In a multi-partition database the same storage paths are used on all database partitions. If a multi-partition database is being restored with new storage paths, then the catalog partition must be restored before any other database partitions are restored.
numStoragePaths
Input. The number of storage paths in the storagePaths parameter of the db2StoragePathsStruct structure.

db2gRestoreStruct data structure specific parameters

iSourceDBAliasLen
Input. Specifies the length in bytes of the piSourceDBAlias parameter.
iTargetDBAliasLen
Input. Specifies the length in bytes of the piTargetDBAlias parameter.
iStagingDBAliasLen
Input. A four-byte unsigned integer representing the length in bytes of the piStagingDBAlias parameter.
iApplicationIdLen
Input. Specifies the length in bytes of the poApplicationId parameter. Should be equal to SQLU_APPLID_LEN + 1. The constant SQLU_APPLID_LEN is defined in sqlutil header file that is located in the include directory.
iTimestampLen
Input. Specifies the length in bytes of the piTimestamp parameter.
iTargetDBPathLen
Input. Specifies the length in bytes of the piTargetDBPath parameter.
iReportFileLen
Input. Specifies the length in bytes of the piReportFile parameter.
iUsernameLen
Input. Specifies the length in bytes of the piUsername parameter. Set to zero if no user name is provided.
iPasswordLen
Input. Specifies the length in bytes of the piPassword parameter. Set to zero if no password is provided.
iNewLogPathLen
Input. Specifies the length in bytes of the piNewLogPath parameter.
iLogTargetLen
Input. Specifies the length in bytes of the piLogTarget parameter.
iRedirectScriptLen
Input. A four-byte unsigned integer representing the length in bytes of the name of the library specified in piRedirectScript. Set to zero if no script name is given.
iEncrLibraryLen
Input. A four-byte unsigned integer that represents the length in bytes of the name of the library that is specified in the piEncrLibrary parameter. Set to zero if no library name is given.

db2Char data structure parameters

pioData
A pointer to a character data buffer. If NULL, no data will be returned.
iLength
Input. The size of the pioData buffer.
oLength
Output. The number of valid characters of data in the pioData buffer.

Usage notes

Snapshot restore

Like a traditional (non-snapshot) restore, the default behavior when restoring a snapshot backup image will be to NOT restore the log directories - DB2RESTORE_LOGTARGET_EXCLUDE.

If the DB2 manager detects that any log directory's group ID is shared among any of the other paths to be restored, then an error is returned. In this case, DB2RESTORE_LOGTARGET_INCLUDE or DB2RESTORE_LOGTARGET_INCFORCE must be specified, as the log directories must be part of the restore.

The DB2 manager will make all efforts to save existing log directories (primary, mirror and overflow) before the restore of the paths from the backup image takes place.

If you want the log directories to be restored and the DB2 manager detects that the preexisting log directories on disk conflict with the log directories in the backup image, then the DB2 manager will report an error. In such a case, if you have specified DB2RESTORE_LOGTARGET_INCFORCE, then this error will be suppressed and the log directories from the image will be restored, deleting whatever existed beforehand.

There is a special case in which the DB2RESTORE_LOGTARGET_EXCLUDE option is specified and a log directory path resides under the database directory (for example, /NODExxxx/SQLxxxxx/LOGSTREAMxxxxx/). In this case, a restore would still overwrite the log directory as the database path, and all of the contents beneath it, would be restored. If the DB2 manager detects this scenario and log files exist in this log directory, then an error will be reported. If you specify DB2RESTORE_LOGTARGET_EXCLUDE, then this error will be suppressed and those log directories from the backup image will overwrite the conflicting log directories on disk.