Note |
---|
Applies to VoipNow 3 and newer! |
After running out of disk space or after similar unexpected events, database tables often become corrupted. Depending on the table that has crashed, this can affect various system functions. To identify and fix the issue, follow the steps below.
Step-by-step guide
Identify the issue
Usually you can find this issue in the logs. For example, when Asterisk tries to read the call_history table, it reports a message similar to the one below.
Code Block |
---|
MySQL server error.SELECT SUM(duration) AS in_sum FROM call_history WHERE start >= '2015-01-01' AND start < ADDDATE('2015-01-01', INTERVAL 1 MONTH) AND flow = 'in'Table 'call_history' is marked as crashed and should be repaired |
As a result, reports will not work.
Shell |
---|
mysqlcheck -u`cat /etc/voipnow/.sqldb | awk -F ":" '{print $2}'` -p`cat /etc/voipnow/.sqldb | awk -F ":" '{print $3}'` voipnow call_history |
When the table is OK, the output is this:
Code Block |
---|
voipnow.call_history OK |
You can also perform a check on all tables (beware that this will create load on the system):
Shell |
---|
mysqlcheck -u`cat /etc/voipnow/.sqldb | awk -F ":" '{print $2}'` -p`cat /etc/voipnow/.sqldb | awk -F ":" '{print $3}'` voipnow |
Fix the crashed table
To fix the table, simply log in to MySQL.
Shell |
---|
mysql -u`cat /etc/voipnow/.sqldb | awk -F ":" '{print $2}'` -p`cat /etc/voipnow/.sqldb | awk -F ":" '{print $3}'` voipnow |
And run:
Shell |
---|
MariaDB [voipnow]> repair table call_history; |
Related articles
Content by Label |
---|
showLabels | false |
---|
max | 5 |
---|
sort | modified |
---|
showSpace | false |
---|
reverse | true |
---|
type | page |
---|
labels | tables asterisk mysql |
---|
|