EssRestoreDatabase

Restores a database from a backup, archive file that you specify.

Syntax

ESS_FUNC_M EssRestoreDatabase (hCtx, AppName, DbName, BackupFileName, bForceDiffName, Count, ReplaceVol);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

Login context

AppName

ESS_STR_T

Application Name

Note:

Works only at the database level. The AppName parameter specifies an Application in order to access the database residing within.

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.

  • ESS_TRUE—force a different application and/or database name for the restore.

    If you use ESS_TRUE and the application and database name is same as the backup, the result is the same as ESS_FALSE

  • ESS_FALSE—use application and database names stored in the backup file. Verifies that the names in backup file are same the ones to which you are restoring to.

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:

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

  • EssArchiveDatabase