EssArchiveDatabase

Creates an archive of a database in a specified backup file.

Syntax

ESS_FUNC_M EssArchiveDatabase (hCtx, AppName, DbName, BackupFileName, OptionsFileName, bOverWrite);
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 in which to archive data. Specify the full path, for example:

c:\hyperion\Test.arc

OptionsFileName

ESS_FILENAME_T

Reserved for the future.

Note:

For this release, use an empty string.

bOverWrite

ESS_BOOL_T

Boolean:

  • ESS_TRUE—oveoorwrite existing back up file

  • ESS_FALSE—do not overwrite

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

  • EssRestoreDatabase