Repair Corrupted Internal Database

Version 9.1 by michaely on 2015/10/20 13:17

In some cases the internal database can become corrupted and prevent use of the iSymphony application. Users will normally see errors like the following when accessing the panel:

Information

The error may vary slightly from the example below.

org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: rowcount remaining=5 SYS" [50000-169]
### The error may exist in com/xmlnamespace/panel/server/core/pbx/callhistory/CallHistoryMapper.xml
### The error may involve com.xmlnamespace.panel.server.core.pbx.callhistory.CallHistoryMapper.getByExtension
### The error occurred while executing a query
### Cause: org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: rowcount remaining=5 SYS" [50000-169]

Repair Process

In order to recover your data, you will need to run a repair process on the database. The repair process is outlined below:

  1. Stop the iSymphony server. SeeĀ Starting And Stopping The iSymphony Server
  2. Create a temporary directory to perform the recovery.

    mkdir isdbrecovery
    cd isdbrecovery
  3. Copy the h2 database jar into the recovery directory:

     

    cp /opt/isymphony3/server/modules/framework/shared/org.h2_1.3.169.jar .
  4. Copy the database file into the recovery directory:

    cp /opt/isymphony3/server/conf/servers/default/isymphony.h2.db .

  5. Run the following command to export the database to an sql file:

 

1) Stop the iSymphony server

service iSymphonyServerV3 stop

2) Create a temporary directory to perform the recovery. Make sure this directory is NOT in /opt/isymphony

mkdir isdbrecovery
cd isdbrecovery

3) Copy the h2 database jar into the recovery directory

cp /opt/isymphony3/server/modules/framework/shared/org.h2_1.3.169.jar .

4) Copy the database file into the recovery directory

cp /opt/isymphony3/server/conf/servers/default/isymphony.h2.db .

5) Run the following command to export the database to an sql file

java -cp org.h2_1.3.169.jar org.h2.tools.Recover

6) Create a sub directory to hold the old database

mkdir old
mv isymphony.h2.db ./old

7) Run the following command to create a new database from the sql file

java -cp org.h2_1.3.169.jar org.h2.tools.RunScript -url "jdbc:h2:./isymphony" -user admin -password admin -script isymphony.h2.sql

8) Move the new database into place

mv isymphony.h2.db /opt/isymphony3/server/conf/servers/default/

9) Restart iSymphony 

service iSymphonyServerV3 start