Page 1 of 1

Error Repairing Sql databases..

PostPosted: Sun Aug 28, 2011 2:05 pm
by javad-afzal
Hi,
I tried to repair mysql databases with this command
"mysqlcheck -u root -p --auto-repair --check --optimize --all-databases"
at the end i get following error..


Repairing tables
asterisk.vicidial_agent_log
error : 5 when fixing table
Error : Error writing file '/var/lib/mysql/asterisk/vicidial_agent_log.MYI' (Errcode: 5)
status : Operation failed


i also get this auto generated mail messaage ,,
''''
DBD::mysql::st execute failed: Table './asterisk/vicidial_agent_log' is marked as crashed and last (automatic?) repair failed at /usr/share/astguiclient/AST_cleanup_agent_log.pl line 223.
executing: SELECT agent_log_id,pause_epoch,wait_epoch from vicidial_agent_log where pause_sec>43999 and event_time > "2011-08-28 23:03:02" and event_time < "2011-08-29 01:23:02"; Table './asterisk/vicidial_agent_log' is marked as crashed and last (automatic?) repair failed at /usr/share/astguiclient/AST_cleanup_agent_log.pl line 223.
''''


I m not very good on Sql databases, kindly help me on this... Thanks...

PostPosted: Sun Aug 28, 2011 5:43 pm
by williamconley
is your hard drive full?

Code: Select all
df -h

No Harddisk is not full

PostPosted: Sun Aug 28, 2011 6:40 pm
by javad-afzal
Thanks Bro for your reply
No Harddisk is not full butt whenever i try to repair it, there is an error on ssh which says "end_request: I/O error , dev sda, sector 139845254"

i have gone through logs they are as following..

Aug 29 07:15:09 vici kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002
Aug 29 07:15:09 vici kernel: sda: Current: sense key: Medium Error
Aug 29 07:15:09 vici kernel: Add. Sense: Read retries exhausted
Aug 29 07:15:09 vici kernel:
Aug 29 07:15:09 vici kernel: Info fld=0x855de86
Aug 29 07:15:09 vici kernel: end_request: I/O error, dev sda, sector 139845254
.....

PostPosted: Sun Aug 28, 2011 8:03 pm
by williamconley
force a disk check and reboot (it can't check the disk while running, so it'll check during startup)

PostPosted: Sun Aug 28, 2011 8:09 pm
by javad-afzal
i have tried
Code: Select all
shutdown -rF 0

PostPosted: Sun Aug 28, 2011 8:19 pm
by williamconley
when it started up did it check the disk? and ... did it fix anything?

and more importantly ... do you have a good backup from which you can restore?

another "coool" trick ... is to EMPTY the agent log table with phpMyAdmin and then immediately back up your database before anything else can become corrupted.

PostPosted: Sun Aug 28, 2011 8:26 pm
by javad-afzal
ya it checked the disk but didnt repaired it.. still getting the same sector problem, can you tell if i can take all the backup means all the databases and put it in the new version goautodial? so now i have to change the HDD or is there any way of repairing it?

PostPosted: Sun Aug 28, 2011 9:54 pm
by williamconley
dude, if you can get a good database backup right now, count your lucky stars that you didn't lose your data. the cost of the HD is nothing compared to reconstruction.

let me ask you this: suppose you manage to get the database backed up, get the disk working again and have 25 agents working on this box ... how long will it be before this drive dies again? do you really wanna find out?

back up the data.

dump the disk in a trash can.

blow the $40 on a new one (or pull one from a Workstation if you're really cheap!)

PostPosted: Mon Aug 29, 2011 10:31 am
by javad-afzal
Thanks bro Thank you very much for your kind support..
yeh thats what i want to do now, Buy another HDD and and put all the databases in it, thats what i was wondering, How to take backup of the databases and put it in the latest version which is GOAutodial.. currently i m using an old version of Vicidialnow.. i dont know how to take my current databases backup.. can you plz guide me through it, it will be really kind of you..




kernel #1 SMP i686 i386

vici.vicidialnow.org 2.6.18-164.el5.vnow | Vicidial VERSION: 2.0.5-174 BUILD: 90522-0506 | Asterisk 1.2.30.2 | Single Server | No Extra Software After Installation

PostPosted: Mon Aug 29, 2011 10:35 am
by javad-afzal
I mean all my current campaigns, their settings, all my sip trunks, all phone logins and users, most importantly all my current LEADS which are in it..

PostPosted: Mon Aug 29, 2011 12:22 pm
by friendlysol
You can use "hdclone" to clone the drive and hope the data is good.

PostPosted: Mon Aug 29, 2011 12:53 pm
by javad-afzal
by hdclone i ll be getting same old version for vicidial & a corrupted database. i want to use my existing database in goautodial.. is it possible to import my old dump file from vicidialnow to Goautodial?

PostPosted: Mon Aug 29, 2011 1:43 pm
by friendlysol
MAYBE if you did it on a few select tables you could import if the schema is similar.

You could then maybe move lists, phones, users, etc. But I don't know the schema of goautodial so don't take my advise unless you know what you are doing.

PostPosted: Mon Aug 29, 2011 7:14 pm
by williamconley
vicidial's manager manual should describe the use of the backup function.

all perl scripts are in /usr/share/astguiclient ... including "ADMIN_backup.pl".

execute:

Code: Select all
perl /usr/share/astguiclient/ADMIN_backup.pl --help


will back up data to /var/log/astguiclient/archive

another simpler method is:

Code: Select all
mysqldump asterisk > 2011-08-29_1234_asterisk.sql -p
the -p is only necessary if you have a mysql root password.

then you use another cool package named "WinSCP" (Free!) in SFTP mode (which uses your ssh putty console credentials!) to copy this to your Windows Hard drive. Then you can push it right back to the next machine (but make sure that gets copied off your system NOW in case the machine dies tonight!)

then you will need to put it into an identical system to use it or upgrade the database to whatever version you install on the next machine using the information in the UPGRADE document in /usr/share/astguiclient/VERSION

Re: Error Repairing Sql databases..

PostPosted: Fri May 16, 2014 5:33 pm
by Robin009
mysqlcheck doesn't support multiple contradicting commands. i am facing this error when i try to repair my database using this command mysqlcheck -u cron -p --auto-repair --check --optimize --all-databases

do reply me fast

Re: Error Repairing Sql databases..

PostPosted: Tue Jun 10, 2014 2:39 am
by williamconley
Robin009 wrote:mysqlcheck doesn't support multiple contradicting commands. i am facing this error when i try to repair my database using this command mysqlcheck -u cron -p --auto-repair --check --optimize --all-databases

do reply me fast

1) Welcome to the Party! 8-)

2) As you are obviously new here, I have some suggestions to help us all help you:

When you post, please post your entire configuration including (but not limited to) your installation method and vicidial version with build.

This IS a requirement for posting along with reading the stickies (at the top of each forum) and the manager's manual (available on EFLO.net, both free and paid versions)

You should also post: Asterisk version, telephony hardware (model number is helpful here), cluster information if you have one, and whether any other software is installed in the box. If your installation method is "from scratch" you must post your operating system and should also post the .iso version from which you installed your original operating system. If your installation is "Hosted" list the site name of the host.

If this is a "Cloud" or "Virtual" server, please note the technology involved along with the version of that techology (ie: VMware Server Version 2.0.2). If it is not, merely stating the Motherboard model # and CPU would be helpful.

Similar to This:

Vicibox X.X from .iso | Vicidial X.X.X-XXX Build XXXXXX-XXXX | Asterisk X.X.X | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation | Intel DG35EC | Core2Quad Q6600

3) Optimize already runs in crontab -e, no need to run it randomly (so skip --optimize). Check is implied by "mysqlCHECK" already (so skip --check).
Code: Select all
mysqlcheck -u cron -p --auto-repair --all-databases


4) Happy Hunting 8-)