Wiki source code of Repair Corrupted Internal Database
Version 7.1 by michaely on 2015/10/20 13:35
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. (% style="color: rgb(60,62,67);font-family: Verdana , Arial , Helvetica;font-size: small;line-height: 17.7273px;background-color: rgb(248,248,248);" %)Stop the iSymphony server. See [[doc:ISYMDOCS.Starting And Stopping The iSymphony Server]]. | ||
21 | 1. ((( | ||
22 | (% 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" %)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 | (% 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; font-weight: normal; line-height: 17.7273px" %)**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 | (% style="color: rgb(60,62,67);font-family: Verdana , Arial , Helvetica;font-size: small;line-height: 17.7273px;background-color: rgb(248,248,248);" %)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 | (% style="color: rgb(60,62,67);font-family: Verdana , Arial , Helvetica;font-size: small;line-height: 17.7273px;background-color: rgb(248,248,248);" %)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 | (% style="color: rgb(60, 62, 67); font-family: Verdana, Arial, Helvetica; font-size: small; line-height: 17.7273px; background-color: rgb(248, 248, 248); color: rgb(60, 62, 67)" %)Create a sub directory to hold the old database: | ||
70 | |||
71 | |||
72 | |||
73 | {{code language="bash"}} | ||
74 | mkdir old | ||
75 | mv isymphony.h2.db ./old | ||
76 | {{/code}} | ||
77 | |||
78 | |||
79 | |||
80 | |||
81 | |||
82 | |||
83 | ))) | ||
84 | 1. ((( | ||
85 | (% style="color: rgb(60,62,67);" %)Run the following command to create a new database from the sql file: | ||
86 | |||
87 | {{code language="bash"}} | ||
88 | java -cp org.h2_1.3.169.jar org.h2.tools.RunScript -url "jdbc:h2:./isymphony" -user admin -password admin -script isymphony.h2.sql | ||
89 | {{/code}} | ||
90 | |||
91 | (% style="color: rgb(60,62,67);" %) | ||
92 | |||
93 | ))) | ||
94 | 1. ((( | ||
95 | (% style="color: rgb(60, 62, 67); color: rgb(60, 62, 67)" %)Move the new database into place: | ||
96 | |||
97 | |||
98 | |||
99 | {{code language="bash"}} | ||
100 | mv isymphony.h2.db /opt/isymphony3/server/conf/servers/default/ | ||
101 | {{/code}} | ||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | {{info}} | ||
110 | 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. | ||
111 | {{/info}} | ||
112 | |||
113 | |||
114 | |||
115 | |||
116 | |||
117 | |||
118 | ))) | ||
119 | 1. ((( | ||
120 | Restart iSymphony. (% style="color: rgb(60,62,67);" %)See [[doc:ISYMDOCS.Starting And Stopping The iSymphony Server]]. | ||
121 | ))) | ||
122 | |||
123 | (% class="MsoNormal" style="font-size: 11.0pt;font-family: Calibri , sans-serif;color: rgb(60,62,67);line-height: 13.5pt;" %) | ||
124 |