Restore Database from Backup

A database backup is stored in an archive volume, which can be located within the cluster (local archive volume) or on another system (remote archive volume). In case of a database instance failure or error, the database can be restored to a previous state using a backup.

Prerequisites

  • The database must be stopped. For more information, see Stop a Database.
  • The database that you are restoring the backup to must have the same number of active nodes as the one used to create the backup.
  • The version of the database that you are restoring the backup to must be based on the same LTS version as the backup version. For more information, see Product Life Cycle.

If you want to restore a backup of an Exasol 7.1 database to an Exasol 8 database, see Migrate from Exasol 7.1 to Exasol 8.

Procedure

This procedure can be carried out using the Administration API.

The examples in this procedure are written using Bash on a Linux terminal. You can also use other interfaces and languages to execute the curl commands.

Placeholder values are styled as Bash variables, starting with the dollar sign ($) and using UPPERCASE characters. Replace the placeholders with your own values before executing the curl command.

  1. Get information about the database by sending a GET request to the /api/v1/databases endpoint. For example:

    curl -k -X "GET" \
    "https://$EXASOL_IP/api/v1/databases" \
    -H "accept: application/json" \
    -H "Authorization: Basic $AUTH_TOKEN"

    The response will include the following:

    • Database ID
    • Database name
    • Database version
    • Provider type
    • Number of clusters in the database
    • Number of clusters running
    • Volumes

    Additional database parameters and hardware details may be included in the response depending on the configuration and platform.

  2. Determine the ID of the backup to restore.

    How to determine the ID for a backup depends on whether you are restoring the backup to the same database that the backup was taken on, or to a different database. In the latter case, the backup is said to have been taken on a foreign database.

    List backups from the same database:

    To get information about all existing backups for the current database, send a GET request to /api/v1/databases/DATABASE_ID/backups. For example:

    curl -k -X 'GET' \
      'https://$EXASOL_IP/api/v1/databases/$DATABASE_ID/backups' \
      -H 'accept: application/json' \
      -H 'Authorization: Basic $TOKEN'

    List backups from all databases:

    Backups taken on foreign databases cannot be listed using the Administration API. In this case you must use the ConfD job db_backup_list with the show_foreign parameter set to True.

    confd_client -c db_backup_list -a 'db_name: DATABASE_NAME' show_foreign: True

    Example of backup ID:

    A backup ID has the structure VOLUME_ID BACKUP_NAME BACKUP_DATABASE_NAME.

    • VOLUME_ID is the ID of the archive volume containing the backup.

    • BACKUP_NAME is the path and name of the backup file, consisting of the following parameters:

      BACKUP_DATABASE_NAME/id_BACKUP_ID/level_BACKUP_LEVEL/node_0/backup_TIMESTAMP

    • BACKUP_DATABASE_NAME is the name of the database that was backed up.

    For example:

    10002 DATABASE_NAME/id_12/level_0/node_0/backup_202110041744 BACKUP_DATABASE_NAME
  3. To restore a backup, send a PUT request to the /api/v1/databases/DATABASE_ID/backups/restore endpoint, and include the backup ID and restore type for the backup in the request. For example:

    curl -k -X 'PUT' \
      'https://$EXASOL_IP/api/v1/databases/$DATABASE_ID/backups/restore' \
      -H 'accept: application/json' \
      -H 'Authorization: Basic $TOKEN' \
      -H 'Content-Type: application/json' \
      -d '{
      "backupId": "$VOLUME_ID $BACKUP_ID $DATABASE_ID",
      "restoreType": "blocking"
    }'

When the backup has been successfully restored, the database will automatically restart.

Verification

To verify the database has been restored, connect to the database and view the latest entries in EXA_SYSTEM_EVENTS:

SELECT MEASURE_TIME, EVENT_TYPE FROM EXA_SYSTEM_EVENTS ORDER BY MEASURE_TIME DESC;

You should see entries with RESTORE_START and RESTORE_END similar to the following:

MEASURE_TIME EVENT_TYPE
2021-10-05 13:18:47.351000 STARTUP
2021-10-05 13:18:42.727000 RESTORE_END
2021-10-05 13:18:40.503000 RESTORE_START