I am working on a web application that queries a database that has two tables. I think I have an issue with data corruption. One of my tables is fine, and I have dumped it and backed it up. I populated the database from some MongoDB data that I parsed through with a python script.
I am using HeidiSQL to work with my database and I cannot view the corrupted table unless I specify "innodb_force_recovery = 4" (which I believe creates a read-only version of tables) in my.ini. Even so, I cannot perform a mysqldump on the table after I specify that condition.
Then I thought, maybe it was a problem with HeidiSQL. It wasn't. Even from the command line mysqld, I could not perform any actions on the corrupted database. Below I show the error message that I got.
Error message in mysqld as viewed via command line
Even the XAMPP Control Panel throws the following error upon startup:
160705 14:41:34 [ERROR] mysqld got exception 0x80000003 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware.
So. At this point, I could re-run my python script, but I assume that I would hit the same error.
How do you recommend I go about handling this problem?
The tablespace is corrupt and your ultimate goal is to take a dump and re-create InnoDB tablespaces from scratch.
When you start with innodb_force_recovery=4
dump all tables one by one. Write a script that loops through all databases and all tables. Add --skip-lock-tables
to mysqldump
, sometimes it helps.
Then try higher values of innodb_force_recovery
: 5 and 6. Try to dump remaining tables that crashed MySQL with innodb_force_recovery=4
.
If you still unable to dump tables then google for "percona data recovery toolkit" or "undrop-for-innodb". These tools both work with InnoDB tablespaces at low level and allow to fetch records from InnoDB pages skipping corrupted areas.
When you have all dumps remove all innodb files (ibdata1, ib_logfile* and *.ibd if there are any) and import the dumps.
User contributions licensed under CC BY-SA 3.0