MySQL从数据文件恢复innodb

昨天晚上,我的MySQL服务器崩溃,现在我有几个数据库,我无法恢复的数据。

根据错误日志,表空间中的危险发生在不久前(几个月),但是没有人注意到,昨天,当MySQL崩溃(出于完全不同的原因),它只是没有开始以下错误:

2015-06-09 23:09:23 14642 [Note] InnoDB: Starting crash recovery. 2015-06-09 23:09:23 14642 [Note] InnoDB: Reading tablespace information from the .ibd files... 2015-06-09 23:09:24 14642 [ERROR] InnoDB: Tried to read 16384 bytes at offset 0. Was only able to read 0. 2015-06-09 23:09:24 7f648369a7e0 InnoDB: Operating system error number 2 in a file operation. InnoDB: The error means the system cannot find the path specified. InnoDB: If you are installing InnoDB, remember that you must create InnoDB: directories yourself, InnoDB does not create them. 2015-06-09 23:09:24 14642 [ERROR] InnoDB: File (unknown): 'read' returned OS error 71. Cannot continue operation 

当数据库以innodb-force-recovery设置为6启动时,服务器启动,错误日志中有大量消息:

 2015-06-09 23:16:50 16659 [ERROR] InnoDB: Failed to find tablespace for table '"db1234"."tbl456"' in the cache. Attempting to load the tablespace with space id 275772. 

我设法转储大部分数据库,并将其导入到清理数据目录。 但是有些dbs已经损坏了表空间,我不能转储它们(甚至打开它们中的任何表)。

所以现在我有几个(大约一百)数据库,不能被加载到活的MySQL服务器。 我有他们的数据文件(包括.frm和.ibd文件),但它们以某种方式损坏,MySQL无法打开它们:

 2015-06-10 18:37:18 3965 [Warning] InnoDB: Cannot open table db123/tbl456 from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem. 

我试图将数据文件复制到另一个MySQL实例,但没有成功,我甚至尝试创build新的.frm文件(但我不知道表的结构),停止服务器,用正确的,启动服务器并打开它们 – 再次没有成功。

可悲的是,我没有这些数据库的备份,因为很久以前它们被损坏了,备份转储未能保存任何数据。

所以现在我有innodb数据文件中的数据,但不能将它们加载到实时服务器。 有没有办法如何拯救他们?

我发现这个工具包: https : //www.percona.com/software/mysql-innodb-data-recovery-tools ,但我不知道是否有可能使用它,它相当复杂,我没有看到如何恢复一百个数据库,这个结构对我来说是未知的。

服务器使用MySQL 5.6.17,从源代码编译。

作为Percona数据恢复工具包的作者,我build议您使用TwinDB数据恢复工具包 。 Percona的工具包在过去的两年中没有任何发展,所有的新function都转到了TwinDB的工具包上。 你的情况是在一个post中描述恢复损坏的MySQL数据库

要恢复表结构,可以使用mysqlfrm工具或从InnoDB字典中恢复结构