Wiki source code of Repair Corrupted Internal Database
Version 6.1 by michaely on 2015/10/20 13:39
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | In some cases the internal database can become corrupt and prevent use of the iSymphony application. Users will normally see errors like the following when accessing the panel: | ||
2 | |||
3 | {{info}} | ||
4 | The error may vary slightly from the example below. | ||
5 | {{/info}} | ||
6 | |||
7 | {{code}} | ||
8 | org.apache.ibatis.exceptions.PersistenceException: | ||
9 | ### Error querying database. Cause: org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: rowcount remaining=5 SYS" [50000-169] | ||
10 | ### The error may exist in com/xmlnamespace/panel/server/core/pbx/callhistory/CallHistoryMapper.xml | ||
11 | ### The error may involve com.xmlnamespace.panel.server.core.pbx.callhistory.CallHistoryMapper.getByExtension | ||
12 | ### The error occurred while executing a query | ||
13 | ### Cause: org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: rowcount remaining=5 SYS" [50000-169] | ||
14 | {{/code}} | ||
15 | |||
16 | == Repair Process == | ||
17 | |||
18 | In order to recover your data, you will need to run a repair process on the database. The repair process is outlined below: | ||
19 | |||
20 | 1. Stop the iSymphony server. See [[doc:ISYMDOCS.Starting And Stopping The iSymphony Server]]. | ||
21 | 1. ((( | ||
22 | Create a temporary directory to perform the recovery.(% style="color: rgb(60,62,67);font-family: Verdana , Arial , Helvetica;font-size: small;line-height: 17.7273px;background-color: rgb(248,248,248);" %) | ||
23 | |||
24 | |||
25 | {{code language="bash"}} | ||
26 | mkdir isdbrecovery | ||
27 | cd isdbrecovery | ||
28 | {{/code}} | ||
29 | |||
30 | {{note}} | ||
31 | Do not create this directory anywhere inside the **/opt/isymphony3** directory. | ||
32 | {{/note}} | ||
33 | |||
34 | (% style="color: rgb(60, 62, 67); font-family: Verdana, Arial, Helvetica; font-size: small; line-height: 17.7273px; background-color: rgb(248, 248, 248); line-height: 17.7273px" %) | ||
35 | |||
36 | ))) | ||
37 | 1. ((( | ||
38 | Copy the h2 database jar into the recovery directory: | ||
39 | |||
40 | {{code language="bash"}} | ||
41 | cp /opt/isymphony3/server/modules/framework/shared/org.h2_1.3.169.jar . | ||
42 | {{/code}} | ||
43 | ))) | ||
44 | 1. ((( | ||
45 | Copy the database file into the recovery directory: | ||
46 | |||
47 | {{code language="bash"}} | ||
48 | cp /opt/isymphony3/server/conf/servers/default/isymphony.h2.db . | ||
49 | {{/code}} | ||
50 | |||
51 | {{info}} | ||
52 | If you have Core Servers other than default you will need to replace default with the slug of the core server you are repairing the database for. | ||
53 | {{/info}} | ||
54 | |||
55 | (% style="color: rgb(60,62,67);font-family: Verdana , Arial , Helvetica;font-size: small;line-height: 17.7273px;background-color: rgb(248,248,248);" %) | ||
56 | |||
57 | ))) | ||
58 | 1. ((( | ||
59 | Run the following command to export the database to an sql file: | ||
60 | |||
61 | {{code language="bash"}} | ||
62 | java -cp org.h2_1.3.169.jar org.h2.tools.Recover | ||
63 | {{/code}} | ||
64 | |||
65 | (% style="color: rgb(60,62,67);font-family: Verdana , Arial , Helvetica;font-size: small;line-height: 17.7273px;background-color: rgb(248,248,248);" %) | ||
66 | |||
67 | ))) | ||
68 | 1. ((( | ||
69 | Create a sub directory to hold the old database: | ||
70 | |||
71 | {{code language="bash"}} | ||
72 | mkdir old | ||
73 | mv isymphony.h2.db ./old | ||
74 | {{/code}} | ||
75 | ))) | ||
76 | 1. ((( | ||
77 | Run the following command to create a new database from the sql file: | ||
78 | |||
79 | {{code language="bash"}} | ||
80 | java -cp org.h2_1.3.169.jar org.h2.tools.RunScript -url "jdbc:h2:./isymphony" -user admin -password admin -script isymphony.h2.sql | ||
81 | {{/code}} | ||
82 | |||
83 | (% style="color: rgb(60,62,67);" %) | ||
84 | |||
85 | ))) | ||
86 | 1. ((( | ||
87 | Move the new database into place: | ||
88 | |||
89 | {{code language="bash"}} | ||
90 | mv isymphony.h2.db /opt/isymphony3/server/conf/servers/default/ | ||
91 | {{/code}} | ||
92 | |||
93 | {{info}} | ||
94 | If you have Core Servers other than default you will need to replace default with the slug of the core server you are repairing the database for. | ||
95 | {{/info}} | ||
96 | ))) | ||
97 | 1. ((( | ||
98 | Restart iSymphony. See [[doc:ISYMDOCS.Starting And Stopping The iSymphony Server]]. | ||
99 | ))) |