...
Code Block | ||||
---|---|---|---|---|
| ||||
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. |
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. |
Options: Descriptions:
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
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 |
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 =
Example
...
Code Block | ||
---|---|---|
| ||
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 (Content by label) | ||||||
---|---|---|---|---|---|---|
|