first of all, Please note the scope of this tool:
1) The recovery tool for this application is only available with the InnoDB storage engine, MyISAM does not support
2) Truncate Tabe cannot be restored
3) Drop table, don't even think about it.
Recovery principle:
For the InnoDB storage engine, the delete operation, instead of actually deleting the rows on the physical file, adds a deleted tag to the deleted row, and we use this tool to find the row that labeled the delete tag, then store it in a text, and finally recover the data from load data While the truncate operation is to empty the data rows directly, not add delete tags (view physical files, execute truncate of the table's IBD file will shrink, and execute the delete table, even larger than before)
Body Start:
1. installation Percona Data Recovery tool for InnoDB tools
Well, there's always a need to install some dependent packages.
Yum-y Install ncurses-devel.x86_64
Uneasy this package, will error, what wrong, forget to write in
RPM-IVH glibc-static-2.17-55.el7.x86_64.rpm--force--nodeps ()
Uneasy this package: see what Error:
Gcc-dhave_offset64_t-d_file_offset_bits=64-d_largefile64_source=1-d_largefile_source=1-wall-o3-g-I include-i Mys Ql-source/include-i mysql-source/innobase/include-static-lrt-o page_parser page_parser.c lib/tables_dict.o lib/ Libut.a
/usr/bin/ld:cannot FIND-LRT
COLLECT2:LD return 1
Make: * * [Page_parser] Error 1
2, the formal configuration installation
CD percona-data-recovery-tool-for-innodb-0.5/mysql-source/
./configure
Cd..
Make
[[email protected] percona-data-recovery-tool-for-innodb-0.5]# make
Gcc-i include-i mysql-source/include-i mysql-source/innobase/include-o innochecksum innochecksum.c
Gcc-o Ibdconnect ibdconnect.c
Finally, there is no error message, it is normal
3. OK, the preparation has been completed to restore your data
1) Extract the data you mistakenly deleted from the server level
[Email protected] percona-data-recovery-tool-for-innodb-0.5]#/page_parser-5-f/var/lib/mysql/test/site_ Ksteam.ibd
[[email protected] percona-data-recovery-tool-for-innodb-0.5]# ls
check_data.c create_defs.pl ibdconnect incrementalupdate.c INSTALL mysql-source pages-1494339302 split_dump.pl
constraints_parser Docs ibdconnect.c innochecksum Lib Page_parser pages-1494339674 tables_dict.c
[[email protected] percona-data-recovery-tool-for-innodb-0.5]# ls pages-1494339302/ Fil_page_index /
0-2475 0-2476 0-2477
in the Fil_page_index The primary key and index are generated under the directory, with the lowest data being the primary key, followed by the index of each column, as 0-2475 is the primary key of the Site_ksteam table, 0-2476 is the index of the table
2) Build the table structure of the Site_ksteam table:
[[Email protected]]# ./create_defs.pl--host localhost--port 3306--user root--password 123456--db test--table site_ksteam > Includ E/table_defs.h normal situation without any error
3) you have to execute the make command again.
[email protected] percona-data-recovery-tool-for-innodb-0.5]# Make
Gcc-dhave_offset64_t-d_file_offset_bits=64-d_largefile64_source=1-d_largefile_source=1-wall-o3-g-I include-i Mys Ql-source/include-i mysql-source/innobase/include-static-lrt-o page_parser page_parser.c lib/tables_dict.o lib/ Libut.a
Finally, this message is normal.
4) Save the found data to the/tmp/site_ksteam.txt file
[email protected]percona-data-recovery-tool-for-innodb-0.5]# ./constraints_parser-d -5-f pages-1494339674/fil_page_index/0-2351/>/tmp/site_ksteam.txt-d recover deleted rows;-5 Table file format , default compact;
-f Specifies the primary key directory for the Site_ksteam table
LOAD DATA INFILE '/com/percona-data-recovery-tool-for-innodb-0.5/dumps/default/site_ksteam ' REPLACE into TABLE ' Site_ Ksteam ' fields TERMINATED by ' \ t ' optionally enclosed by ' "' LINES starting by ' site_ksteam\t ' (ID, catid, typeid, title, Style, thumb, keywords, description, posids, URL, listorder, status, Sysadd, Islink, username, inputtime, updatetime, cont Act, titles, level, CImage, bimage, language, subject);
5) connect to MySQL and import data into the table
mysql> LOAD DATA INFILE '/tmp/site_ksteam.txt ' REPLACE into TABLE ' Site_ksteam ' fields TERMINATED by ' \ t ' optionally EN CLOSED by ' "' LINES starting by ' site_ksteam\t ' (ID, catid, typeid, title, style, thumb, keywords, description, posids, ur L, Listorder, status, Sysadd, Islink, username, inputtime, updatetime, contact, titles, level, CImage, bimage, language, s Ubject);
Finally, or want to vomit trough, began to engage in this tool, the online information, hehe, and do not say that the middle may encounter what problems, how to solve, the most important thing is, This tool restores the database that is running online, and the data loss occurs!!!
In the end is where I did not understand, or this is the case, welcome message!
This article is from the "you ' re the best" blog, declined reprint!
Statement under Percona Data Recovery tool for InnoDB tools problem! (with description of problems encountered)