There is a link on the desktop to TwinDB’s website, this help a lot to understand the concept and how to recover a corrupted table.
But when you want to recover a full database with let’s say 100+ table it could be a real pain because there is a lot of command to recover table structure and data.
So i made a little shell script (your database must be innodb_file_per_table=1)
So let’s start, first, download the script :
wget http://mysql.on.windows.free.fr/wp-download/RecovDB.sh
then grant the right to execute the scripts
chmod +x RecovDB.sh
then, launch the script !
./RecovDB dataDirPath dbname
- replace dataDirPath by the MySQL data directory path
- replace dbname by the name of the database you want to recover
Then you will have a subfolder “dump” created, you will find some files :
- Load Data.SQL > script to reinject data
- [tableX].sql > Table create statement (1 file per table)
- [tableX].data > Table data (1 file per table)
Note that you can use this script anywhere , you only need undrop for innodb and a mysql service listening on port 3306.
Hope this helps 🙂
Hi, any chance this can work with recovering from ibdata1 as opposed to individual ibd files?
Thanks
Hi Nick,
Unfortunatly, this script only work with “innodb_file_per_table=1” because it’s the default config in my company 🙂
The script is based on this procedure : https://twindb.com/recover-corrupt-mysql-database/
There is no indication that it doesn’t work with “innodb_file_per_table=0”, have you tried it ?
Have you tried innodb_force_recovery=1 to 6, and dump each table one by one ?
I can help you further and try to adapt my script with “innodb_file_per_table=0” for the community on my free time but if you need professional support, i suggest you to contact Aleksandr Kuzminsky @ TwinDB.com and take a look at twindb.com recovery portal.
I hope you’ll recover your data 🙂
Marc.
Hey Marc, I’m getting the message “c_parser.c: command not found” when I run this from within the undrop-for-innodb folder. It looks like the .sql files are right but the data files are empty.
Sorry, that was after I had changed the recoverdb.sh file. The original version of that gives me :
./RecovDB.sh: line 45: ./c_parser: No such file or directory
Hi Carter,
Have you compiled undrop for innodb ?
you should run “make” in undrop folder and you need the following tools to do so : make, gcc, flex and bison.
On CentOS :
yum -y install make gcc flex bison
cd undrop-for-innodb
make
Then you can use RecovDB.sh