Page History
...
- The script is available for Linux and MacOS® using bash shell. The script acts as a wrapper to classes provided by the H2® Java binary.
- The script terminates with exit code 0 to signal successful execution, with exit code 1 for command line argument errors and other exit codes for non-recoverable errors.
- The script is intended as a baseline example for customization by JS7 users and by SOS within the scope of professional services. Examples make use of H2® release 2.3.232.
The Operation Script can be executed from a JS7 job to create database backups at a regular basis.
Download
Download: operate-h2.sh
...
H2 License
H2 ships with the Open Source licenses MPL 2.0 (Mozilla Public License Version 2.0)and EPL 1.0 (Eclipse Public License), for details see https://www.h2database.com/html/license.html.
...
console
- Invokes the H2® Console for use with a browser.
- Users can specify the
--web-port
option and otherwise use default port8082
.
shell
- Invokes the H2® Shell for execution of SQL statements:
- SQL statements can be specified using the
--sql
option. - Using the
--file
option a file can be specified holding SQL statements. - Without the
--sql
and--file
options the interactive H2® Shell will be used.
- SQL statements can be specified using the
- Invokes the H2® Shell for execution of SQL statements:
- backup
- Backup
- When creating backups then a .zip archive is created that holds related database files.
- Backups are transactionally consistent and represent a full backup of the JOC Cockpit database.
- To perform online backups consider mixed mode for connections to the database using the
AUTO_SERVER=TRUE
parameter with the database URL.
- Restore
- To restore a database it is replaced from the database files previously backed up.
- To this purpose JOC Cockpit must be stopped and must be restarted after completion of the restore operation.
- Restoring a database includes to extract the database files from a previoulsy created backup archive and to replace existing database files.
- Exports the database specified to a .zip compressed .archive file.
- The archive file includes the
script.sql
file holding SQL statements that can be used to recreate the database- .
- When using the
--file-versions
option, backup files will be stored in versions:- Each newly created backup file is appended the suffix
-001
. - An existing backup file with the suffix
-001
is renamed to-002
. A backup file with the suffix-002
is renamed to the suffix-003
etc. - When the number of versions specified with the option is exeeded then the earliest backup file is removed.
- Each newly created backup file is appended the suffix
- Backups are created to restore an H2® database for the same version of H2®. For migration of H2® databases to newer versions of the database engine use the
export
andimport
commands.
- Backup
- export
- Exports an H2® database to a .zip compressed .archive file.
- The export file includes the
script.sql
file holding SQL statements that can be used to recreate the database. - When using the
--file-versions
option, export files will be stored in versions:- Each newly created export file is appended the suffix
-001
. - An existing export file with the suffix
-001
is renamed to-002
. An export file with the suffix-002
is renamed to the suffix-003
etc. - When the number of versions specified with the option is exeeded then the earliest export file is removed.
- Each newly created export file is appended the suffix
- Migration of H2® databases includes to export using the H2® Java binary file of the current version of the database engine. Import is performed using the newer version of the H2® Java binary file.
import
- Imports data from an export file that holds the full export
import
- Imports data from a previous backup. Backup files hold the full backup of the database. To restore a database it is recommended to (re)move the existing H2® database. The database will be recreated on import.
- The backup export file created using the
export
command must be extracted to the resultingscript.sql
file. - The path to the
script.sql
file is specified with the--file
option.
...
Overview
Content Tools