This jar File can be found on Git Server:
Using DatabaseDumjperRestorer.java one can dump and restore JRodos database on Windows and Linux.
Following update case for JRodos Database are supported:
3. Run program
DatabaseDumperRestorer is a simple console tool, designed to help a user of PostgreSQL DB Server to perform such basic frequently accessed commands, as:
A) creating dumps (in other words, snapshots, backups) of a list of data bases (by running pg_dump PostgreSQL binary)
B) creating or restoring DB-es from previously created dumps (thus, bringing the state of a set of DB-es to their state at the time, when the dumps were created). This is accomplished by running either pg_restore or psql PostgreSQL binaries, depending on the file format utilized.
The program performs the following steps:
1) Reads the configuration properties’ values from dumprestore.properties. Checks the necessary constraints for them.
2) Creates folder Logs on the root, common to DatabaseDumperRestorer.jar. Checks the presence of <snapshotname> directory on the snapshots.root.path if –restore option is active. Otherwise (–dump is active) attempts to create a directory for snapshots.root.path and a directory for a specific snapshot (if either of them is not present), named as a runtime timestamp. Creates a log file in Logs folder, named according to mask <timestamp>_<operation>_<snapshotname>.
3) Checks, if a connection to each individual database of user’s list can be established in case of –dump being active. Later on ignores the databases’ names, which it failed to connect to. Otherwise(–restore) checks, if a connection to PostgreSQL Server can be established via the specified details. Aborts, if one cannot be set up.
4) Executes the following binaries for each of the databases still present in the list (also sets the environment variables “PGPASSWORD” and “LD_LIBRARY_PATH” to the required values)
The following files are required on the root: 1) DatabaseDumperRestorer.jar 2) dumprestore.properties 3) log4j-1.2.15.jar 4) postgresql-9.4-1201.jdbc4.jar, or a corresponding analogue
2.2 Operating System
Windows and Linux operating system are currently supported.
2.3 Perl Installation
If JRodos Database should be updated from 8.x to 9.x, perl need be installed on your system.
For Windows user, please download “32bit PortableZIP edition” from http://strawberryperl.com/releases.html , then unzip it somewhere. The perl bin path need be defined in dumprestore.properties.
For Linux user, perl is installed as default.
3. Run program
To run the script program, you will need to execute one of the two following instructions from command line:
A)java -jar DatabaseDumperRestorer.jar –dump
B)java -jar DatabaseDumperRestorer.jar –restore <snapshotname>,
where <snapshotname> is the name of folder, containing dump files you wish to restore from. The program will try to locate this folder under <snapshots.root.path> - the parameter, present in configuration file dumprestore.properties.
The descriptions for dumprestore.properties are put below, the default value is assigned to the flag, the optional value is listed a line after the flag.
NOTE: All of the parameter values are required, besides the wait flag.
The DBs.owner property value is required only if --restore option is chosen.
snapshots.root.path=SNAPSHOTS Optional value: SNAPSHOTS; absolute path Both Snapshots folder name and absolute path are supported. If only Snapshots folder name like “SNAPSHOTS” is defined, the folder refers to the place where jar file is executed. If absolute path is defined, the path will be used.
wait=false Optional value: true; false Requires a Boolean value to indicate, whether the program has to wait for user’s response on completion.
format.backup.flag=backup Optional value:backup; text backup format corresponds to compressed format, text format corresponds to sql text format. the sql text format or compressed format; By update PostgreSql from 8.x to 9.x, only backup format is allowed.
DBs.owner=jrodos Optional vlaue: your jrodos database owner The existing jrodos user, to which the databases will be assigned if you choose restore option.
Dbs.owner.password=jrodos Optional value: your jrodos database password The existing postgres password for Dbs.owner
postgresql.dump.host=localhost Optional value: localhost, host which has the database to dump. Fully qualified name or an IP address of the PostgreSQL Server host;
postgresql.dump.port=5432 Optional value: 5432; PostgreSQL Server port for dump.
postgresql.dump.password=model_postgres Optional value: model_postgres; PostgreSQL Server super user “postgres” password; Used for dump database
postgresql.dump.bin.path=“C:\\Program Files\\PostgreSQL\\8.4\\bin” Optional value: “C:\\Program Files\\PostgreSQL\\8.4\\bin”; bin path of the postgresql for dump; If Postgresql 8.x need be dumped by 9.x, the bin.path of 9.x need be defined here;Used for dump database
postgresql.dump.lib.path=“C:\\Program Files\\PostgreSQL\\8.4\\lib” Optional value: “C:\\Program Files\\PostgreSQL\\8.4\\lib”; The absolute lib path, where the PostgreSQL lib are located; If Postgresql 8.x need be dumped by 9.x, the lib.path of 9.x need be defined here;Used for dump database
postgresql.restore.host=localhost Optional value: localhost; Fully qualified name or an IP address of the PostgreSQL Server host for restore; Database will be restored is on this host
postgresql.restore.port=5433 Optional value:5433; PostgreSQL Server port, Database will be restored use this port
postgresql.restore.password=model_postgres Optional value: model_postgres; PostgreSQL Server super user “postgres” password, used for restore database your_password.
postgresql.restore.bin.path=“C:\\Program Files\\PostgreSQL\\9.4\\bin” Optional value: “C:\\Program Files\\PostgreSQL\\9.4\\bin”; The absolute path, where the PostgreSQL bin are located, used for restore database.
postgis.restore.pl=“C:\\Program Files\\PostgreSQL\\9.3\\utils\\postgis_restore.pl” Optional value: “C:\\Program Files\\PostgreSQL\\9.3\\utils\\postgis_restore.pl”; The pl script postgis_restore.pl in PostgreSQL folder
Postgis.legacy.sql=“C:\\Program Files\\PostgreSQL\\9.3\\share\\contrib\\postgis-2.1\\legacy.sql” Optional value: “C:\\Program Files\\PostgreSQL\\9.3\\share\\contrib\\postgis-2.1\\legacy.sql”;The legacy.sql which need be executed by update from 8.x to 9.x
perl.bin.path=“C:\\Program Files (x86)\\Strawberry\\perl\\bin” Optional value: “C:\\Program Files (x86)\\Strawberry\\perl\\bin”; Bin path where the strawberry bin located. Linux User does not need define this flag.
jrodos.db.01=AgriCP Optional value: Name of JRodos databases. The Database which need be dump or restored. The number 01 can be any text. The number need be unique, if more than one databases are defined.