edmiRemoteRestoreBackup
EdmiError edmiRemoteRestoreBackup(SdaiServerContext serverContextId, SdaiOptions options, SdaiString backupLocation, SdaiString databaseName, SdaiString backupName, SdaiInteger backupVersion, SdaiString passwordOfBackupDatabase, SdaiString databaseLocation, SdaiString passwordOfDatabaseToDelete, SdaiSelect extensionsArgs, SdaiInvocationId *edmiInvocationId);
By this command the database is restored from backup. The backup must have been produced by the backup routine edmiRemoteBackupDatabase. During restoration of a database, no clients can use this database. After the database is restored the database can be opened and used as usual.This function is legal for superuser only.
Arguments
1 | Type | Name | Comment |
2 | SdaiServerContext | serverContextId | A superuser context identification, from edmiDefineServerContext |
3 | SdaiOptions | options | Options = NEWEST_VERSION is default when <backupVersion> = 0. See description of the available options below. Multiple options may be selected by combining them with the bitwise OR operator. |
4 | SdaiString | backupLocation | Optionally specify directory for backups, i.e. the <databaseLocation> is default. |
5 | SdaiString | databaseName | The name of the database to be restored |
6 | SdaiString | backupName | Specify the name of the backup. This name is included in the backup file name. See edmiRemoteBackupDatabase. |
7 | SdaiInteger | backupVersion | Optional. Which version of the backup to restore |
8 | SdaiString | passwordOfBackupDatabase | Password of the database that shall be restored |
9 | SdaiString | databaseLocation | Directory path where the database is to be restored |
10 | SdaiString | passwordOfDatabaseToDelete | Optional. If the specified directory contains a database, it is not legal overwrite this unless you explicitly specify this by selecting the option [delete existing database]. If that option is selected, the password of the database is specified here. This password could be the same, but must be given anyway. |
11 | SdaiSelect | extensionsArgs | For future extension. Should be NULL |
12 | SdaiInvocationId | *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. |
Return Value
Â
Options
 Â
Option | Comment |
DELETE_EXISTING_DATABASE | If the specified directory contains a database, it is not legal overwrite this unless you explicitly specify this by selecting this option |
NEWEST_VERSION | A backup directory can contain several versions. By this option you select that it is the newest version that shall be restored |
OLDEST_VERSION | By this option you select that it is the oldest version that shall be restored |
OPEN_DATABASE | By this option you specify that the database shall be opened when the restore is finished |
Â
Example
Â
 EdmiError rstat; SdaiServerContext superContextId; SdaiOptions options = DELETE_EXISTING_DATABASE | OPEN_DATABASE; SdaiString backupLocation = "C:/home/backups/"; SdaiString databaseName = "proj"; SdaiString backupName = "PROJ1"; SdaiInteger backupVersion = 0; /* NEWEST_VERSION is used */ SdaiString dbPassword = ""pro123"; /* same password used on backup */ SdaiInteger databaseLocation = "C:/home/db"; SdaiString message = NULL; SdaiSession sessionId = 0; SdaiRepository repId = 0; . . . /* Create Server Context */ rstat = edmiDefineServerContext("SuperContext", "superuser", "", "super123", "TCP", "9090", "MyServerHost", NULL, NULL, NULL, NULL, NULL, &superContextId); /* Restore the database from backup */ if (rstat = edmiRemoteRestoreBackup(superContextId, options, backupLocation, databaseName, backupName, backupVersion, dbPassword, databaseLocaltion, dbPassword, NULL, NULL) { printf("\nError %d in edmiRemoteRestoreBackup: %s", rstat, edmiGetErrorText(rstat)); goto error; } rstat = edmiConnect("Johnny", "Supervisor", "cf37ftr", &message); rstat = sdaiOpenSession(&sessionId); rstat = edmiOpenRepositoryBN("DataRepository", sdaiRW, &repId); /* now the database is up and running again! */ ...
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â