Restores a database from a backup, archive file that you specify.
Syntax
ESS_FUNC_M EssRestoreDatabase (hCtx, AppName, DbName, BackupFileName, bForceDiffName, Count, ReplaceVol);
Parameter | Data Type | Description | ||
---|---|---|---|---|
hCtx | ESS_HCTX_T | Login context | ||
AppName | ESS_STR_T | Application Name
| ||
DbName | ESS_STR_T | Database Name | ||
BackupFileName | ESS_STR_T | Full path to the backup file from which to read archive data. Specify the full path, for example: c:\hyperion\Test.arc | ||
bForceDiffName | ESS_BOOL_T | Use a different application and database names for the restore.
| ||
Count | ESS_USHORT_T | Optional Number of disk volume replacement structures that are being restored. | ||
ReplaceVol | ESS_PDISKVOLUME_REPLACE_T | Optional Disk volume replacement input structures. |
Return Value
Returns:
0—If successful
Error number—If unsuccessful
Access
The caller must have Essbase Administrator access to the database.
Example
void RestoreDB() { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_STR_T AppName = "Backup"; ESS_STR_T DbName = "Basic"; ESS_STR_T BackupFileName = "F:\\testArea\\ArchiveAndRestore\\TempBackup.arc"; ESS_STR_T optionsFileName = ""; ESS_BOOL_T bOverWrite; ESS_BOOL_T bForceDiffName; ESS_USHORT_T count; ESS_PDISKVOLUME_REPLACE_T replaceVol; printf("\nArchive DB:\n"); bOverWrite = ESS_TRUE; sts = EssArchiveDatabase(hCtx, AppName, DbName, BackupFileName, optionsFileName, bOverWrite) printf("EssArchiveDatabase sts: %ld\r\n",sts); sts = EssUnloadApplication(hCtx, AppName); printf("\nEssUnloadApplication sts: %ld\r\n",sts); printf("\nCase with no volume replacement:\n"); bForceDiffName = ESS_FALSE; count = 0; replaceVol = ESS_NULL; sts = EssRestoreDatabase (hCtx, AppName, DbName, BackupFileName, bForceDiffName, count, replaceVol); printf("EssRestoreDatabase sts: %ld\r\n",sts); printf("\nCase with a replacement volume (index and page files to a different volume):\n"); bForceDiffName = ESS_FALSE; count = 1; if (count) { sts = EssAlloc(hInst, count * sizeof(ESS_DISKVOLUME_REPLACE_T), (ESS_PPVOID_T)&replaceVol); memset(replaceVol, 0, count * sizeof(ESS_DISKVOLUME_REPLACE_T)); } strcpy(replaceVol->szPartition_Src, "C"); strcpy(replaceVol->szPartition_Dest, "F"); sts = EssUnloadApplication(hCtx, AppName); printf("\nEssUnloadApplication sts: %ld\r\n",sts); sts = EssRestoreDatabase (hCtx, AppName, DbName, BackupFileName, bForceDiffName, count, replaceVol); printf("EssRestoreDatabase sts: %ld\r\n",sts); if (replaceVol) EssFree(hInst, replaceVol); }
See Also