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


1TypeNameComment
2SdaiServerContext

serverContextId

A superuser context identification, from edmiDefineServerContext

3SdaiOptions

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.

4SdaiString

backupLocation

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

5SdaiString

databaseName

The name of the database to be restored

6SdaiString

backupName

Specify the name of the backup. This name is included in the backup file name. See edmiRemoteBackupDatabase.

7SdaiInteger

backupVersion

Optional. Which version of the backup to restore

8SdaiString

passwordOfBackupDatabase

Password of the database that shall be restored

9SdaiString

databaseLocation

Directory path where the database is to be restored

10SdaiString

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.

11SdaiSelect

extensionsArgs

For future extension. Should be NULL

12SdaiInvocationId

*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


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


  

OptionComment

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.