All pages
Powered by GitBook
1 of 5

Loading...

Loading...

Loading...

Loading...

Loading...

Database backup recovery

Cover
Restoring Oracle database
Cover
Restoring MySQL database
Cover
Restoring Microsoft SQL database
Cover
Restoring PostgreSQL database

Restoring Oracle database

This article explains how to restore an Oracle database from a backup.

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.

Xopero recommends restoring the database files to their original directory to avoid potential permission issues in a different location.

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

  • /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:


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:

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.

Restoring Microsoft SQL database

This article explains how to restore a Microsoft SQL database from a backup.

Microsoft SQL database can be restored to its original location or to a new temporary directory.


How to restore Microsoft SQL database from backup

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

To restore files backed up using a file-level backup plan follow this guide. If your database was backed up using an image-level backup, use granular recovery to restore it as described in this article.

Xopero recommends restoring the database files to their original directory to avoid potential permission issues in a different location.

Once the database files are restored, the next step is to import them into the Microsoft SQL environment.

1

Open the Microsoft SQL Management Studio.

2

Log in to the directory tree, right-click Databases, and select the Restore Database option.

3

In the opened window, select Device as the backup source and provide the path to the folder containing the *.bak database dump file.

4

After selecting the *.bak file, click OK.

5

The database has been successfully restored and is now listed in the directory tree.

Restoring PostgreSQL database

This article explains how to restore a PostgreSQL database from a backup.

PostgreSQL database can be restored to its original location or to a new temporary directory.


How to restore PostgreSQL database from backup

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

To restore files backed up using a file-level backup plan follow this guide. If your database was backed up using an image-level backup, use granular recovery to restore it as described in this article.

Xopero recommends restoring the database files to their original directory to avoid potential permission issues in a different location.

Once the database files are restored, the next step is to import them into the PostgreSQL environment.

1

Log in to your database server using SSH.

2

Enter the following command:

This command does not create the database. If you want to import the database dump file into a non-existing database, you must create the database first. If you want to restore the dump file to an existing database, you must drop the database, create it again, and then import the dump file.

3

The database has been successfully restored

/opt/XoperoONEBackupAgent/Xopero.Device.App --oracle-restore database_ID backupuser /home/backupuser/oracle/oracle_database_dump
/opt/XoperoONEBackupAgent/Xopero.Device.App --oracle-restore database_ID backupuser /home/backupuser/oracle/oracle_database_dump true
psql dbname < dumpfile.sql

Restoring MySQL database

This article explains how to restore a MySQL database from a backup.

MySQL database can be restored to its original location or to a new temporary directory.


How to restore MySQL database from backup

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

To restore files backed up using a file-level backup plan follow this guide. If your database was backed up using an image-level backup, use granular recovery to restore it as described in this article.

Xopero recommends restoring the database files to their original directory to avoid potential permission issues in a different location.

Once the database files are restored, the next step is to import them into the MySQL environment. To restore the database to the MySQL server, use a database management tool.

This guide uses the MySQL command-line utility.

1

To restore the database, log in to the database server using the following command:

mysql -h SERVER_ADDRESS -u USER -p
  • SERVER_ADDRESS — the address of the MySQL server where the database will be restored

  • USER — the username of the database user

2

Next, type:

USE DATABASE_NAME
  • DATABASE_NAME — the name of the database where the dump file will be restored

‼️ If the corrupted database still exists in MySQL, first drop it and recreate the database using the following command:

CREATE DATABASE DATABASE_NAME
  • DATABASE_NAME — the name of the database to be created for importing the database dump

After creating the new database, use the USE DATABASE_NAME command as described above.

3

The database backup is restored using the SOURCE PATH_TO_FILE command, replacing PATH_TO_FILE with the full path to the previously restored database file. The syntax is as follows:

SOURCE PATH_TO_FILE

Useful links and items

MySQL :: Download MySQL Utilities (Archived Versions)dev.mysql.com