6.2.1.5.2.2. Recovery steps

(1) Create recovery dump of corrupted database

This dump generates an SQL script containing all the data of the corrupted DB.

To generate the SQL dump, the following important hints need to be followed:

  • H2 DB server needs to be shut down (e.g. systemctl stop iamdb)
  • Run the following command (in /home/h2database) - it generates an sql file with the recovery information:
  • copy
    java -cp h2/bin/h2-1.4.196.jar org.h2.tools.Recover -dir data -db iamdb

(2) Create new database from recovery file

Start the database again (e.g. using systemctl start iamdb) and then create a new database named "iamd.recovered" from the recovery sql file:

copy
java -cp h2/bin/h2*.jar org.h2.tools.RunScript \
-url jdbc:h2:tcp://localhost:9001/iamdb.recovered \
-user iam -password password \
-script data/iamdb.h2.sql \
-checkResults