Tool for Backup HSQLDB

Greetings,

because my old server is becoming more and more unstable I need an active mitigation to save my precious xwiki (now doing daily backups and moving them away from the server)
2018/02/18 21:43:25.555 DEBUG [main] [base] webinf = /usr/local/XWiki Enterprise 8.4/webapps/xwiki/WEB-INF/ OK
2018/02/18 21:43:25.560 DEBUG [main] [base] backupdir = /usr/local/XWiki Enterprise 8.4/data/backup/ OK
2018/02/18 21:43:25.587 DEBUG [main] [base] zip = true OK
2018/02/18 21:43:25.587 DEBUG [main] [base] search = true OK
2018/02/18 21:43:25.604 DEBUG [main] [base] read 3 keys from /usr/local/XWiki Enterprise 8.4/webapps/xwiki/WEB-INF/xwiki.properties
2018/02/18 21:43:25.604 ERROR [main] [base] can not retrieve entry with key environment.permanentDirectory from file /usr/local/XWiki Enterprise 8.4/webapps/xwiki/WEB-INF/xwiki.properties
2018/02/18 21:43:25.607 INFO [main] [base] searching xwiki_db …
2018/02/18 21:43:25.653 INFO [main] [base] found file /usr/local/XWiki Enterprise 8.4/data/database/xwiki_db.lobs, using path as path to database
2018/02/18 21:43:25.660 DEBUG [main] [base] using jdbc:hsqldb:file:/usr/local/XWiki Enterprise 8.4/data/database/xwiki_db.lobs;shutdown=true
2018/02/18 21:43:26.409 INFO [main] [hsqldb.db.HSQLDB61AA9D6B0C.ENGINE] checkpointClose start
2018/02/18 21:43:26.410 INFO [main] [hsqldb.db.HSQLDB61AA9D6B0C.ENGINE] checkpointClose synched
2018/02/18 21:43:26.491 INFO [main] [hsqldb.db.HSQLDB61AA9D6B0C.ENGINE] checkpointClose script done
2018/02/18 21:43:26.576 INFO [main] [hsqldb.db.HSQLDB61AA9D6B0C.ENGINE] checkpointClose end
2018/02/18 21:43:26.634 INFO [main] [base] connection to HSQLDB successful
2018/02/18 21:43:26.639 INFO [main] [base] Statement created
2018/02/18 21:43:26.640 INFO [main] [base] starting BACKUP DATABASE TO ‘/usr/local/XWiki Enterprise 8.4/data/backup/’ NOT BLOCKING COMPRESSED
2018/02/18 21:43:26.641 INFO [main] [hsqldb.db.HSQLDB61AA9D6B0C.ENGINE] Initiating backup of instance ‘xwiki_db.lobs’
2018/02/18 21:43:26.690 INFO [main] [hsqldb.db.HSQLDB61AA9D6B0C.ENGINE] Successfully backed up instance ‘xwiki_db.lobs’ to ‘/usr/local/XWiki Enterprise 8.4/data/backup/’
2018/02/18 21:43:26.691 INFO [main] [base] completed BACKUP DATABASE TO ‘/usr/local/XWiki Enterprise 8.4/data/backup/’ NOT BLOCKING COMPRESSED
2018/02/18 21:43:26.872 INFO [main] [hsqldb.db.HSQLDB61AA9D6B0C.ENGINE] Database closed

If anybody is interested in this (and you have java installed while running on linux), I could upload it somewhere.

:keyboard: :koala:

See also https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Backup

In the case of HSQLDB all you need to is to save the content of the permanent directory (since I assume you’ve used the demo distribution which puts the HSQLDB content in the permanent directory).

Thanks for sharing!

You can save the directory of a database and might get a working backup but because of how databases work, saving “living” files very often yields into a inconsistent backup (and nearly all databases get very picky if you present them some inconsistent files for working). To do this, you will have to stop the wiki to avoid the issue with inconsistencies.

The tool (I have created) does the backup with database methods (backup command) and as this will save a consistent state even when the database is running (you can do this of course without the tool but you will have the hassle to use the command line client and you have to figure out WHERE HSQLDB is running or find a a suitable backup dir otherwise (that depends on how you installed it) - both will be mitigated by the tool as it tries to read the configuration files and when that fails, it searches for the databases files, backups will be written to a backup folder in the xwiki tree, so there is a high success chance to get a backup even when you don’t know how and where the xwiki is installed.

:keyboard: :koala: