Open topic with navigation

# Restoring the Database

You can use the following information to restore a backed up database. This section has the following topics:

- Prerequisites for Restoring the Database

- Restoring a Backup

## Prerequisites for Restoring the Database

Before restoring a backup, make a note of the following requirements:

- The database name must match the database name in the backup.

- The number of nodes in the primary subcluster must be equal to the number of nodes that were present in the primary subcluster at the time the backup was taken.

- Database node names must match the names of nodes in the backup.

- Use the same catalog directory location that was used in the database when the backup was taken.

- Use the same port numbers that were used by the database when the backup was taken.

- For object restore, have the same shard subscriptions. If the shard subscriptions have changed, then you can only perform full restore. Shard subscriptions can change when you add or remove nodes or rebalance the cluster.

- The database cannot be restored while it is still running. Run db_installer to stop, start, or check the status of the database. If you must stop the database, also run ./scripts/watchdog.sh disable to disable the watchdog.

You must stop the database to perform a full restore. Run `db_installer stop-db` to stop the database. However, the database must be running to perform an object restore. Run `db_installer start-db` to start the database.

## Restoring a Backup

You can restore a full or object backup of a database that has primary and secondary subclusters to a new (target) database. The target database can have both primary and secondary subclusters. However, the backup is restored only to the primary subclusters of the target database.

To restore a backup, use following command from the database scripts path (`/opt/arcsight-db-tools/scripts`):

    ./db_backup.sh restore

You can use the following parameters:

`--archive=<timestamp_value>` | To specify a timestamp of the backup that you want to restore. For example: `./db_backup.sh restore --archive=20211006_205934`
`--restore-objects=<objects>` | To specify the individual objects you want to restore from a full or object-level backup. If you are using wildcards, then use`--include-objects` and `--exclude-objects` instead. For example: `./db_backup.sh restore --restore-objects=default_secops_adm` This parameter is invalid in combination with parameters `--include-objects` and `--exclude-objects`.
`--include-objects=<objects>` | To specify database objects or pattern of objects to restore from a full or object-level backup. Use comma to delimit multiple objects and wildcard patterns. For example: `./db_backup.sh restore --include-objects=default_secops_adm` You cannot use this parameter with`--restore-objects` parameter.
`--exclude-objects=<objects>` | Used along with `--include-objects` option, to specify database objects or pattern of objects you want to remove from the set. Use comma to delimit multiple objects and wildcard patterns. For example: `./db_backup.sh restore --include-objects=default_adm --exclude-objects=default_secops_adm` You cannot use this parameter with`--restore-objects` parameter.

After restore completes, execute the restart commands:

    ./db_installer start-db

    ./kafka_scheduler delete

    ./kafka_scheduler create

    ./scripts/watchdog.sh enable

After the database is restored, it takes some time before all data is populated in the Fusion dashboard.