Kohei Nozaki's blog 

Derby database backup script


Posted on Friday Feb 20, 2015 at 02:49PM in Technology


As Roller, and a virtual machine on VMware Fusion, I wrote an another Ant script which backups an Apache Derby database to automate backup of data of my Apache James server. the script has easy purge function as a target named purge too. intended environment is as follows:

  • Linux server

  • Accepts connection via ssh

  • Has executable ij command which is simple CLI JDBC frontend program shipped with Derby

  • Requires Derby instance to listen a port

It works as follows:

  1. Invoke SYSCS_UTIL.SYSCS_FREEZE_DATABASE() with ij to freeze the database

  2. Create a tarball of the database

  3. Invoke SYSCS_UTIL.SYSCS_UNFREEZE_DATABASE() with ij to unfreeze the database

  4. Download the tarball

  5. Delete the tarball

A bad thing is that due to lack of streaming download in sshexec task, it needs extra free space on the server. the script can be obtained from my GitHub repository.