---
title: "Operations: Server: How to Restore a Database from the Backup"
url: "https://docs.ravendb.net/6.2/client-api/operations/server-wide/restore-backup"
version: "6.2"
language: "java"
---

# Operations: Server: How to Restore a Database from the Backup

> Client language: Java. Also available for [C#](https://docs.ravendb.net/6.2/client-api/operations/server-wide/restore-backup.md), [Node.js](https://docs.ravendb.net/6.2/client-api/operations/server-wide/restore-backup.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

- To restore a database from its backup, use `RestoreBackupOperation`.
- A backup can also be restored using [Studio](https://docs.ravendb.net/6.2/studio/database/create-new-database/from-backup.md).

## Syntax

```java
public RestoreBackupOperation(RestoreBackupConfigurationBase restoreConfiguration);

public RestoreBackupOperation(RestoreBackupConfigurationBase restoreConfiguration, String nodeTag);
```

```java
public abstract class RestoreBackupConfigurationBase {


  public String getDatabaseName() {
      return databaseName;
  }

  public void setDatabaseName(String databaseName) {
      this.databaseName = databaseName;
  }

  public String getLastFileNameToRestore() {
      return lastFileNameToRestore;
  }

  public void setLastFileNameToRestore(String lastFileNameToRestore) {
      this.lastFileNameToRestore = lastFileNameToRestore;
  }

  public String getDataDirectory() {
      return dataDirectory;
  }

  public void setDataDirectory(String dataDirectory) {
      this.dataDirectory = dataDirectory;
  }

  public String getEncryptionKey() {
      return encryptionKey;
  }

  public void setEncryptionKey(String encryptionKey) {
      this.encryptionKey = encryptionKey;
  }

  public boolean isDisableOngoingTasks() {
      return disableOngoingTasks;
  }

  public void setDisableOngoingTasks(boolean disableOngoingTasks) {
      this.disableOngoingTasks = disableOngoingTasks;
  }

  public boolean isSkipIndexes() {
      return skipIndexes;
  }

  public void setSkipIndexes(boolean skipIndexes) {
      this.skipIndexes = skipIndexes;
  }

  public BackupEncryptionSettings getBackupEncryptionSettings() {
      return backupEncryptionSettings;
  }

  public void setBackupEncryptionSettings(BackupEncryptionSettings backupEncryptionSettings) {
      this.backupEncryptionSettings = 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 | Disable on doing tasks |
| **skipIndexes** | boolean | Skip the indexes |

## Example

```java
RestoreBackupConfiguration config = new RestoreBackupConfiguration();
config.setBackupLocation("C:\\backups\\Northwind");
config.setDatabaseName("Northwind");
RestoreBackupOperation restoreOperation = new RestoreBackupOperation(config);
store.maintenance().server().send(restoreOperation);
```

## See also

- [Create DB: From Backup](https://docs.ravendb.net/6.2/studio/database/create-new-database/from-backup.md)
- [Create DB: General Flow](https://docs.ravendb.net/6.2/studio/database/create-new-database/general-flow.md)
- [Create DB: Encrypted](https://docs.ravendb.net/6.2/studio/database/create-new-database/encrypted.md)
- [The Backup Task](https://docs.ravendb.net/6.2/studio/database/tasks/backup-task.md)
- [Restore](https://docs.ravendb.net/6.2/client-api/operations/maintenance/backup/restore.md)
- [What Is Smuggler](https://docs.ravendb.net/6.2/client-api/smuggler/what-is-smuggler.java.md)
- [Backup](https://docs.ravendb.net/6.2/client-api/operations/maintenance/backup/backup-overview.md)
- [Backup Overview](https://docs.ravendb.net/6.2/server/ongoing-tasks/backup-overview.md)
- [Migration](https://docs.ravendb.net/6.2/migration/server/data-migration.md)
