Database recovery commands

Database recovery commands

Check and repair mysql db

mysqlcheck -A -r


[ERROR] mysqld: Table './mysql/servers' is marked as crashed and last (automatic?) repair failed

myisamchk -r /var/lib/mysql/*/*.MYI
myisamchk -r /var/lib/mysql/mysql/db.MYI

or

service mariadb stop

mysqld_safe --skip-grant-tables --skip-networking &

mysql -u root

REPAIR TABLE mysql.plugin;
REPAIR TABLE mysql.servers;
REPAIR TABLE mysql.db;
FLUSH PRIVILEGES;

service mariadb restart

These commands will backup existing CDR and queue_log data using mysqldump

mysqldump scopserv cdr > cdr.sql

mysqldump scopserv queue_log > queuelog.sql


These commands will restore mysqldump CDR and queue_log data using mysqldump

mysqldump scopserv cdr > cdr.sql

mysqldump scopserv queue_log > queuelog.sql


Rebuild CDR and queue_log data from Master.csv file located in /var/log/asterisk/cdr-csv/Master.csv

/var/www/scopserv/realtime/queue2sql --recover /var/log/asterisk/cdr-csv/Master.csv

Rebuild CDR and queue_log data from Master.csv file located in custom directory

/var/www/scopserv/realtime/queue2sql --recover YOUR_FILE

Backup Only Telephony configuration using mysqldump

mysqldump scopserv asterisk_extensions.sql

Restore Only Telephony configuration using mysqldump

mysql scopserv < asterisk_extensions.sql



C5 to R8 upgrade fails to update CDR

Probably DBs structure requires update:
rm all .lock file in ~scopserv/telephony/scripts/upgrade/ directory using:
rm -f /var/www/scopserv/telephony/scripts/upgrade/*.lock
then run update script
php /var/www/scopserv/telephony/scripts/update

Command that should fix SQL data / recordings:

/bin/sh /var/www/scopserv/telephony/scripts/scopserv_fix_cdr.sh

Check if there is data in cdr_pre SQL table:

SELECT COUNT(*) FROM cdr_pre;

Check if there is data in cdr_post SQL table:

SELECT COUNT(*) FROM cdr_post;

If no data = then run the FIX scripts
If data = restart CRON script

Command to import missing data from CSV

/bin/sh /var/www/scopserv/telephony/scripts/scopserv_import_cdr.sh [CSV file (optional)]

To restore blank CDR

kill -KILL [PROCESS ID] ; php -q /var/www/scopserv/telephony/scripts/crond-reports-realtime.php

To find the PROCESS ID use:
ps aux |grep crond-reports-realtime

Damaged mysql db:

cd /var/lib/mysql/scopserv
myisamchk -r cdr

To remove old reports:

MariaDB [scopserv]> delete from cdr where calldate < '2019-01-01 00:00:00';
-> delete from queue_log where time < '2019-01-01 00:00:00';
-> delete from cel where eventtime < '2019-01-01 00:00:00';
show tables LIKE 'cel%';
then : drop table cel_;

Updating from C5 to C6+

/var/www/scopserv/realtime/queue2sql –migrate

Force telephony25 switch (pre telephony25 systems)
scopserv-switch--25
service asterisk restart
service scopserv_fastagi restart

After updating telephony package to telephony25 versions or executing a telephony25 switch from earlier release:

php -q /var/www/scopserv/telephony/scripts/update--force
scopserv-switch--25
service asterisk restart
service scopserv_fastagi restart

Upgrading from asterisk pre 18 version or toggling to asterisk 18 from any other version...

asterisk-switch --18
service asterisk restart
service scopserv_fastagi restart


    • Related Articles

    • Scheduled Reports feature in ScopSTATS

      Scheduled Reports feature allows to automatically create any CDR, ACD or IVR report in the specified time. To create a scheduled report, in ScopSTATS, go to Scheduled Reports section and click Add button. Scheduled Report also has a generation ...
    • ScopSTATS Admin Guide

      ScopSTATS Admin Guide ScopSTATS is the ScopServ toolkit for generating real time reports, historical data, and system statistics. It also bundles ScopSWITCH utilities to manage your Call Centre and Operator functions. This document is a must read for ...
    • Module20 - ScopTEL IP PBX Software - Reports-Summary

      Introduction to ScopSTATS Reporting Engine Real-time data access (real-time monitoring). Enhanced information tracking thanks to simultaneous access to multiple reports. Simplified and unified filters, easy access to reports (CDR, DAA, RVI...). ...
    • How to create a Survey using CDR Tag Codes

      Since Telephony package 2.6.50 release, it is now easy to create a Survey IVR menu using the “Tag Code” feature. This article will help you to setup your system and to get the reports.   Survey Options The Survey Options are specified in an IVR menu ...
    • A New Skin for SCOPSTATS

      Our real-time statistical engine, SCOPSTATS retains the same functionality in a redesigned interface but with an intuitive display that is faster and can be viewed in day or night mode. This update includes the following improvements: Code ...