Database management

Database backup

License Server database backups are recommended. ZeroTurnaround is unable to guarantee database integrity in case of local hardware failure. Regular backup processes are highly recommended. In addition, it is recommended to back up the database before upgrading the License Server!


Do not attempt copying the database file when the License Server is running! Doing so risks database corruption.

There are two safe ways to create a backup copy of the database while the License Server is running.

Creating a backup using the GUI

Database backup can be performed via the Configuration page.


Creating a backup using the REST API

Use the following REST API action for periodical automated backups.

GET /api/admin/backup-database?token=<my authentication token>

You will receive a JSON response, indicating database backup success and the backup path.


Restoring the database from a backup

  1. Safely shut down the License Server.
  2. Overwrite the database file db.h2.db in $LS/data/db/ folder using your backup file.
  3. Restart the License Server.

Compacting the database

License Server uses an H2 database engine that is backed up by a file system file. When the database usage intensifies, the file size can increase. H2 often appends data to the end of the file – instead of utilizing free space in the middle parts of the file. This leads both to increased storage uptake as well as affecting License Server performance. To combat this, H2 features internal database file compacting. This cannot be performed during runtime. The compacting is instead performed during a short period when the JVM has received a shutdown command. The License Server has set the default time for compacting the database to 6000 milliseconds. This default can be overridden using the JVM argument All values are provided in milliseconds.

The default value has been set to prevent accidental cancellation. It is recommended to allow H2 to run this procedure for a longer period, e.g. 20 seconds. To do this, configure the value as follows:

./bin/ start

Please shut down and restart the License Server occasionally. Make sure to use the polite shutdown procedure. Not using the polite shutdown skips database compacting. Using arbitrary shutdown can also corrupt the database.