Compacter la base de données H2/ Compact H2 Database
Produit concerné / Related product | JMap | Versions | 7.0 |
---|
Problème
La base de données H2 augmente indéfiniment et la durée d'un backup augmente relativement.
Explication
Selon http://h2database.com/html/features.html#compacting, «L'espace vide du fichier de base de données a été réutilisé automatiquement.
Lorsque vous fermez la base de données, celle-ci est automatiquement compactée par défaut pendant 200 millisecondes au maximum." Pour compacter plus utilisez la solution ci-après.
Solution
Pour éviter le crash du serveur lors du démarrage, nous suggérons un manuel SHUTDOWN COMPACT comme solution de contournement pour compacter d'avantage. Voici les étapes :
Arrêter le serveur JMap
Ouvrez un terminal ou une invite de commande et accédez à <JMAP_HOME> / db
Exécuter la commande ci-dessous (remplacer <JMAP_HOME> par le chemin de votre installation JMap):
..\jre\bin\java -cp ../lib/ignite/ignite-indexing/h2-1.4.195.jar org.h2.tools.Script -url "jdbc:h2:/<JMAP_HOME>/db/system;DB_CLOSE_ON_EXIT=TRUE;AUTO_SERVER=TRUE;TRACE_LEVEL_FILE=4;TRACE_LEVEL_SYSTEM_OUT=0" -user sa -script backup.zip -options compression zip
3.1 Faire un backup manuellement des fichiers system.*.db
Supprimer les fichiers de base de données : <JMAP_HOME>/db/system.*
Exécuter la commande ci-dessous (remplacez <JMAP_HOME> par le chemain de votre installation JMap):
..\jre\bin\java -cp ../lib/ignite/ignite-indexing/h2-1.4.195.jar org.h2.tools.RunScript -url "jdbc:h2:/<JMAP_HOME>/db/system;DB_CLOSE_ON_EXIT=TRUE;AUTO_SERVER=TRUE;TRACE_LEVEL_FILE=4;TRACE_LEVEL_SYSTEM_OUT=0" -user sa -script backup.zip -options compression zip
Redémarrer JMap Server
English version
Problem
The H2 database increases indefinitely and the duration of a backup increases relatively.
Explication
According to http://h2database.com/html/features.html#compacting, "Empty space in the database file re-used automatically. When closing the database, the database is automatically compacted for up to 200 milliseconds by default. " To compact more use the solution below.
Solution
To prevent the server crashing during startup, we suggest a manual SHUTDOWN COMPACT as a workaround to compact more. Here are the steps:
Stop the JMap Server
Open a terminal or command prompt and navigate to <JMAP_HOME> / db
Run the command below (replace <JMAP_HOME> with the path of your JMap installation):
..\jre\bin\java -cp ../lib/ignite/ignite-indexing/h2-1.4.195.jar org.h2.tools.Script -url "jdbc:h2:/<JMAP_HOME>/db/system;DB_CLOSE_ON_EXIT=TRUE;AUTO_SERVER=TRUE;TRACE_LEVEL_FILE=4;TRACE_LEVEL_SYSTEM_OUT=0" -user sa -script backup.zip -options compression zip
Delete the database files: <JMAP_HOME> /db/system.*
Run the command below (replace <JMAP_HOME> with the path of your JMap installation):
..\jre\bin\java -cp ../lib/ignite/ignite-indexing/h2-1.4.195.jar org.h2.tools.RunScript -url "jdbc:h2:/<JMAP_HOME>/db/system;DB_CLOSE_ON_EXIT=TRUE;AUTO_SERVER=TRUE;TRACE_LEVEL_FILE=4;TRACE_LEVEL_SYSTEM_OUT=0" -user sa -script backup.zip -options compression zip
Restart JMap Server