# Versio.io Managed backup &amp; restore

## Backup

To back up a Versio.io server instance with all environment data, the following command must be executed:

```bash
# Backup all Versio.io content data
bash /opt/versio.io/install/utils/backup-database-content.sh
```

*Command: Back up a Versio.io instance including all environment data*

You can customize the backup folder via the OS environment variable `VERSIO_BACKUP_FOLDER`. The backup script creates SQL dumps in the folder `$VERSIO_BACKUP_FOLDER/sql-dump/<date>-<time>/` with file names `versio.io-database-backup_<table>.sql.gz`.

To ensure data integrity, the Versio.io server instance is stopped, the backup is performed and the Versio.io server instance is restarted. This means that the Versio.io server is not available during this time. The downtime depends on the data volume to be backed up and is displayed at the end of the backup execution.

It is recommended to run the backup regularly, e.g. based on cron jobs:

```bash
# Crontab configuration for daily backup. Please configure it for user 'versio'!
40 0 * * * /opt/versio.io/install/utils/backup-database-content.sh
```

*Configuration: Cronjob configuration for daily backup*

> [!WARNING]
>
> **Attention**
>
> If you are not running the Versio.io platform as `VERSIO_DEPLOYMENT_PROFILE=standalone`, you should run the backup script on the `application` and `database` host at the same time. This will ensure that the data from the different databases is saved at the same time.

> [!TIP]
>
> Use Versio.io *Batch Job Monitoring* to monitor the daily backup process.

## Restore

To restore all data managed by Versio.io, you can run the following script. Please note: You will need a working Versio.io platform instance! All data in the database of the current instance managed by Versio.io will be overwritten!!!

```bash
# Restore all Versio.io content data
bash /opt/versio.io/install/utils/restore-database-content.sh <backup-date-time>
```

*Command: Restore a Versio.io instance from a backup*

> [!WARNING]
>
> **Attention**
>
> If you are not running the Versio.io platform as `VERSIO_DEPLOYMENT_PROFILE=standalone`, you should run the restore script on the `application` and `database` host at the same time. This will ensure that the data from the different databases is restored at the same time.

Please note that reprocessing of the full-text search and topology detection must be performed for each (!) environment when restoring backup data:

- see `Environment Settings - Full-text search - Reprocess environment`
- see `Environment Settings - Topology detection - Reprocess environment`

> [!NOTE]
>
> **Recommendation**
>
> It is strongly recommended that the restore process be tested at least every six months to ensure that you are able to take action in the event of a disaster.
