# Restoring Oracle database

#### An Oracle database can be restored to its original location or to a new temporary directory.

***

## How to restore an Oracle database from backup

The first step in restoring an **Oracle** database from backup is to restore the database files from storage to a temporary directory. These files will then be imported into the **Oracle** database environment.

To restore files backed up using a file-level backup plan follow [this guide](https://helpcenter.xopero.com/xopero-one-en/backup-and-recovery/workstations-and-servers/file-level-backup-recovery).

{% hint style="warning" %}
**Xopero** recommends restoring the database files to their original directory to avoid potential permission issues in a different location.
{% endhint %}

If the database files are restored to a temporary directory, run the following command in the **CLI**:

{% code overflow="wrap" %}

```bash
/opt/XoperoONEBackupAgent/Xopero.Device.App --oracle-restore database_ID backupuser /home/backupuser/oracle/oracle_database_dump
```

{% endcode %}

* `/opt/XoperoONEBackupAgent/Xopero.Device.App` — path to the **Xopero ONE** application
* `--oracle-restore` — parameter used to restore the **Oracle** database
* `database_ID` — ID of the database to be restored
* `backupuser` — user with permission to restore the database
* `/home/backupuser/oracle/oracle_database_dump` — path to the directory containing the restored database files

If the restore completes successfully, information about the restored database will be displayed on the screen:

<figure><img src="https://319733277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0CBTl43C3OO6ySL1DJ6k%2Fuploads%2FFjxF0iXhhJn4V7a0wYAp%2Fimage.png?alt=media&#x26;token=fc57b237-cf5c-412c-b008-b921a847f005" alt=""><figcaption></figcaption></figure>

***

## Restoring the database to the source host when part of it is unavailable

If part of the database is currently unavailable (for example, if a user deleted a table), the restoration process described above may fail, as the deletion is a more recent operation in the database.

The solution is to run the modified command:

{% code overflow="wrap" %}

```bash
/opt/XoperoONEBackupAgent/Xopero.Device.App --oracle-restore database_ID backupuser /home/backupuser/oracle/oracle_database_dump true
```

{% endcode %}

The last optional parameter, required **only when restoring to the source host**, should be set to `true`. This ensures **Xopero** sets the **SCN** (**System Change Number**) to the point immediately after the backup.

Setting this parameter resolves issues with unrestored parts of the database. The restoration method described in the first section of this article will still work, but it may not always produce the expected results.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpcenter.xopero.com/xopero-one-en/backup-and-recovery/workstations-and-servers/database-backup-recovery/restoring-oracle-database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
