Operations: Server: How to Restore a Database from the Backup
- To restore a database from its backup, use
RestoreBackupOperation
.
- A backup can also be restored using Studio.
Syntax
const restoreBackupOperation = new RestoreBackupOperation(restoreConfiguration, "nodeTag");
export interface RestoreBackupConfigurationBase {
databaseName,
lastFileNameToRestore,
dataDirectory,
encryptionKey,
disableOngoingTasks,
skipIndexes,
type,
backupEncryptionSettings
}
Parameters |
|
|
databaseName |
string |
Database name to create during the restore operation |
lastFileNameToRestore |
string |
Used for partial restore |
dataDirectory |
string |
Optional: Database data directory |
encryptionKey |
string |
Encryption key used for restore |
disableOngoingTasks |
boolean |
true/false to disable/enable Ongoing Tasks |
skipIndexes |
boolean |
true/false to disable/enable indexes import |
type |
RestoreType |
Encryption key used for restore |
backupEncryptionSettings |
BackupEncryptionSettings |
Backup encryption settings |
Example
restoreConfiguration = {
databaseName: "Northwind",
skipIndexes: false
}
const restoreBackupOperation = RestoreBackupOperation(restoreConfiguration, "A");
const restoreResult = await store.maintenance.server.send(restoreBackupOperation);