Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated using 4PSA automated script


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;


Content by Label
showLabelsfalse
max5
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("mysql","asterisk","tables") and space = currentSpace()
labelstables asterisk mysql

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.