"Unique index or primary key violation" when importing H2 sql



I’m using Razuna 1.7 with the embedded H2 database. Unfortunately the database was corrupted due to a full filesystem. I’m now trying to recover the database by running a recover with h2. The problem is, that when I try to import the sql-script into a database, the following error appears:

_root@photodatabase:/opt/work/db# java -cp /opt/razuna_tomcat/tomcat/webapps/razuna/WEB-INF/lib/h2-1.3.174.jar org.h2.tools.RunScript -url "jdbc:h2:~/recovertest" -user "sa" -script "/opt/work/db/razuna.h2.sql" 

_ Exception in thread “main” org.h2.jdbc.JdbcSQLException: Eindeutiger Index oder Primärschlüssel verletzt: “PRIMARY KEY ON INFORMATION_SCHEMA.LOB_DATA(BLOCK)”_
_ Unique index or primary key violation: “PRIMARY KEY ON INFORMATION_SCHEMA.LOB_DATA(BLOCK)”; SQL statement:_

_ at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)_
_ at org.h2.message.DbException.get(DbException.java:172)_
_ at org.h2.message.DbException.get(DbException.java:149)_
_ at org.h2.index.PageDataIndex.getNewDuplicateKeyException(PageDataIndex.java:165)_
_ at org.h2.index.PageDataIndex.add(PageDataIndex.java:143)_
_ at org.h2.table.RegularTable.addRow(RegularTable.java:119)_
_ at org.h2.command.dml.Insert.addRow(Insert.java:166)_
_ at org.h2.command.dml.Insert.insertRows(Insert.java:140)_
_ at org.h2.command.dml.Insert.update(Insert.java:86)_
_ at org.h2.command.CommandContainer.update(CommandContainer.java:79)_
_ at org.h2.command.Command.executeUpdate(Command.java:253)_
_ at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:181)_
_ at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:156)_
_ at org.h2.tools.RunScript.process(RunScript.java:255)_
_ at org.h2.tools.RunScript.process(RunScript.java:188)_
_ at org.h2.tools.RunScript.process(RunScript.java:319)_
_ at org.h2.tools.RunScript.runTool(RunScript.java:142)_
_ at org.h2.tools.RunScript.main(RunScript.java:69)_

By using the “-continueOnError” parameter I can finish the import and log in to Razuna again, but I can’t open any asset.

What can I do?



We are already in contact by email. Hence I will answer directly


Yes… contacting directly via mail will help others as well :wink: