Automatic H2 Migration tool, first release for testing

487 views
Skip to first unread message

Andreas Reichel

unread,
Jan 5, 2021, 10:51:23 PM1/5/21
to h2-database
Good Morning.

Compliments of the day. I have written a software program, which migrates/updates H2 databases automatically from older versions (e.g. 1.4) to the latest version (e.g. 2.0).
  • It works for single H2 databases or for all H2 databases in a folder.
  • It includes all relevant H2 libraries and tests automatically, which library to apply. Although you can specify the particular versions to use.
  • It will extract the H2 database to a compressed SQL script (with a version suffix) and create a new H2 database from that script (with a version suffix). In this regards it automates and simplifies the tools H2 already provides.
  • It has a command-line interface and work has started on a simple Swing UI.
  • It has support for the H2 metadata model and I would like to develop scripts using these meta data to find problems in the old H2 databases before migration. Samples and use cases are needed.

Usage

  java -jar H2MigrationTool.jar -l <arg> -f <arg> -t <arg> -d <arg>
         [-u <arg>] [-p <arg>] [-s <arg>] [-c <arg>] -o <arg> [--force] [-h]
   -l,--lib-dir <arg>        Folder containing the H2 jar files.
   -f,--version-from <arg>   Old H2 version of the existing database.
   -t,--version-to <arg>     New H2 version to upgrade to.
   -d,--db-file <arg>        The existing H2 database (old format).
   -u,--user <arg>           The database username.
   -p,--password <arg>       The database password.
   -s,--script-file <arg>    The export script file.
   -c,--compression <arg>    The Compression Method [ZIP, GZIP]
   -o,--options <arg>        The upgrade options [VARIABLE_BINARY]
      --force                Overwrite files and continue on failure.
   -h,--help                 Show the help mesage.

Example

java -jar H2MigrationTool.jar -l /home/are/Downloads/h2-libs                        \
                              -f 1.4.199 -t 2.0.201 -d /home/are/.manticore/riskbox \
                              -c ZIP -o VARIABLE_BINARY                             \
                              --force

We have used it for migrating around 10 large H2 files successfully in the past. Although there might be many issue coming up with you particular H2 database, the only way to find and to solve them is trying out.
You kind feedback will be much appreciated.


Please be aware, that I am no H2 developper and this has been developped outside of the H2 project.

Best regards
Andreas





Andreas Reichel

unread,
Feb 12, 2021, 11:27:34 PM2/12/21
to h2-database
Dear All,

we have a functional UI.
H2 DB files can be added by pointing on folders, which will be searched recursively.

Give it a try and let me know what you think.


Best regards
Andreas

Reply all
Reply to author
Forward
0 new messages