Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This function takes backup of the whole EDMdatabase into a directory. Underlying directories with backup versions are created if more than one backup version is wanted. These backup versions can be restored later with the corresponding edmiRemoteRestoreBackup function. These backup/restore functions require that the EDMdatabase version is the same.
This function is legal for superuser only.
One EDMserver thread will run as a kind of "backup daemon". The backup daemon can be started on a given date and time and optionally a periodic execution can be specified, i.e., run backup every midnight as an example.The backup will be given a name and be located on a user specified directory and each backup version will be a sub-directory to this one. The default directory will be the database directory. A maximum number of backup versions will be given, and when the max versions is reached, the oldest will be overwritten by the youngest and so on. A backup result file will be written to the backup directory for each backup operation. The database backup files can be optionally compressed.
During backup operation, the EDMdatabase will be fully accessible for read/query request from any clients, but no write transactions will be permitted, i.e., edmiStartModelsWriteTransaction operation will fail with "Illegal operation during database backup operation". EDMI operations like creation/deletion of repositories, models, users/groups and other system resources will be illegal during database backup operations. Hence, these operations will fail in the same way as an edmiStartModelsWriteTransaction operation
Related functions: edmiRemoteRestoreBackup, edmiRemoteStopBackup, edmiRemoteReadBackupResults, edmiRemoteDeleteBackup , edmiRemoteGetBackupStatus
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteBackupDatabase(SdaiServerContext serverContextId,
                                    SdaiOptions        options, 
                                    SdaiString         backupLocation, 
                                    SdaiString         backupName,  
                                    SdaiInteger        numberOfBackupVersions, 
                                    SdaiString         backupStartTime, 
                                    SdaiString         backupIntervalTime, 
                                    SdaiString         passwordOfBackupDatabaseToDelete, 
                                    SdaiSelect         extensionsArgs, 
                                    SdaiInvocationId   *edmiInvocationId); 
 
Arguments:

serverContextId

A superuser context identification, from edmiDefineServerContext

options

See description of the available options below.
Multiple options may be selected by combining them with the bitwise OR operator.

backupLocation

Optionally specify directory for backups, i.e., <databaseLocation> is default

backupName

Specify the name of the backup included in backup file name. The total backup file name is described below.

numberOfBackupVersions

Specify number of backups versions wanted. The backups are handled in a circular list.

backupStartTime

Specify the start time for the backup. yyyy.mm.dd.hh.mm.ss (year.month.day.hour.min.secs). If not given, the backup starts at once.

backupIntervallTime

Specify the time interval between backups, in seconds. If nothing is given, the backup is performed once.

passwordOfBackupDatabaseToDelete

Optional password.

extensionsArgs

For future extension. Must be NULL

edmiInvocationId

Not yet used. When the edmiInvocationId is specified unequal NULL, the actual operation will be asynchronous and a handle (identifier) of the call will be returned in the edmiInvocationId argument.
This handle can be used in later operations for requesting the status (waiting, running, finished ..) and the result of the actual operation.

Options: Descriptions:

COMPRESS_BACKUP

The backup files are compressed if this option is selected.

CONTINUE_WITH_NEXT_VERSION

The backup will continue with the next backup version.

DELETE_EXISTING_BACKUP

The existing backup version will be overwritten and deleted.

TERMINATE_ACTIVE_BACKUP

The running backup will be terminated by this backup command.

 
The backup file name consists of the following elements:
<BackupLocation>/EDMbackup<dbName><BackupName>/V<nn>/*.bdb
where nn is for number 1 to 99. If number of backup versions is set to zero (0) the "/V<nn>" directory is omitted. <dbName> is the name of the database and "EDMbackup_" is a fixed string prefix.
 
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
EdmiError rstat;
SdaiServerContext superContextId;
 
SdaiOptions options = DELETE_EXISTING_BACKUP | COMPRESS_BACKUP;
SdaiString backupLocation = "C:/home/backups/";
SdaiString backupName = "PROJ1";
SdaiInteger numberOfBackupVersions = 7; /* every day in week */
SdaiString backupStartTime = "2007.07.01.00.00.00"; /* from July 1st 2007 */
SdaiInteger backupIntervalTime = 24 * 60 * 60; /* every 24 hours */
SdaiString databasePassword = NULL;
. . .
 
/* Create Server Context */
rstat = edmiDefineServerContext("SuperContext",
"superuser", "", "super123",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &superContextId);
 
/* Backup the whole database */
if (rstat = edmiRemoteBackupDatabase(superContextId, options, backupLocation,
backupName, numberOfBackupVersions, backupStartTime,
backupIntervalTime, databasePassword, NULL, NULL) {
printf("\nError %d in edmiRemoteBackupDatabase: %s", rstat,
edmiGetErrorText(rstat));
goto error;
}
 
. . .

  • No labels