Database Maintenance

From HSYCO
Jump to navigation Jump to search

HSYCO stores some of its persistent data, like persistent variables and data loggers data, in an embedded HSQLDB database engine.

The database files are stored in the "data" directory.

Database Backup

If the database backup option is enabled, HSYCO performs a daily hot backup of the database, saving a copy of all data in the "data_backup" directory.

Manually copying or downloading the "data" directory while HSYCO is running is not recommended, because the resulting files could be corrupted and not useable to restore the database.


Database Restore Procedure

It is possible to restore the database from a previous backup.

If HSYCO is running, you can conveniently execute the restore procedure from the File Manager.

Starting from the "data_backup" files you want to restore, rename or copy this directory to a directory named "data_restore_now", then select the hsyco.jar file and click the restart button.

HSYCO will restart and, finding the "data_restore_now" directory, will perform the following database restore process:

  • rename the original "data" directory to "data_backup_before_restore". If a directory named "data_backup_before_restore" already exists, a unique number will be appended to the name, preserving the existing directory
  • rename the "data_restore_now" to "data"
  • start the database engine.

HSYCO should start with the database that was saved in "data_backup", with the last snapshot of the database saved in the "data_backup_before_restore" directory.