Commands: How to start backup or restore operations?
To start or restore backup use startBackup
or startRestore
operations respectively.
StartBackup
public void startBackup(String backupLocation, DatabaseDocument databaseDocument, boolean incremental, String databaseName);
Parameters | ||
---|---|---|
backupLocation | String | Path to directory where backup will be stored. |
databaseDocument | DatabaseDocument | Database configuration document that will be stored with backup in 'Database.Document' file. Pass null to use the one from <system> database.WARNING: Database configuration document may contain sensitive data which will be decrypted and stored in backup. |
incremental | boolean | Indicates if backup is incremental. |
databaseName | String | Name of a database that will be backed up. |
Example
store.getDatabaseCommands().getGlobalAdmin().startBackup(
"c:\\temp\\backup\\Northwind\\",
new DatabaseDocument(),
false,
"Northwind"
);
StartRestore
public Operation startRestore(DatabaseRestoreRequest restoreRequest);
Parameters | ||
---|---|---|
restoreRequest | DatabaseRestoreRequest | Restore information |
Example
DatabaseRestoreRequest restoreRequest = new DatabaseRestoreRequest();
restoreRequest.setBackupLocation("c:\\temp\\backup\\Northwind\\");
restoreRequest.setDatabaseLocation("~\\Databases\\NewNorthwind\\");
restoreRequest.setDatabaseName("NewNorthwind");
Operation operation = store.getDatabaseCommands().getGlobalAdmin().startRestore(restoreRequest);
operation.waitForCompletion();