MySQL InnoDB 表损坏——如何修复?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1348350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySQL InnoDB tables corrupt -- how to fix?
提问by atp
While performing a conditional DELETE
operation in one of my InnoDB tables, which apparently required some temporary table to be created in ibdata1, the hard disk filled up and mysql crashed. I couldn't get it to start again until I deleted the ibdata1 file (~30 GB).
在DELETE
我的一个 InnoDB 表中执行条件操作时,显然需要在 ibdata1 中创建一些临时表,但硬盘已满,mysql 崩溃。在删除 ibdata1 文件(~30 GB)之前,我无法让它重新启动。
Now mysql starts again, but all the tables in the database seem to be corrupt (when I do a REPAIR TABLE tablename EXTENDED
I get:
现在 mysql 再次启动,但数据库中的所有表似乎都已损坏(当我执行 a 时,REPAIR TABLE tablename EXTENDED
我得到:
+-----------------------------------+--------+----------+---------+
| Table | Op | Msg_type | Msg_text |
+-----------------------------------+--------+----------+---------+
| mydb.table1 | repair | Error | Unknown table engine 'InnoDB' |
| mydb.table1 | repair | error | Corrupt |
+-----------------------------------+--------+----------+---------+
I was using innodb_file_per_table
option so that all of my .frm and .ibd files (which are supposed to contain metadata and data, respectively) are all intact (with the same filesizes they had before the crash), in the directory: /var/mysql/data/mydb/
. Does anyone know how I could get mysql to recognize these tables with the appropriate data once again?
我用innodb_file_per_table
选项,这样我所有的.FRM和的.ibd文件(假设包含元数据和数据,分别)的全部完好(与他们在飞机坠毁前有同样的filesizes),在目录:/var/mysql/data/mydb/
。有谁知道我如何让 mysql 再次使用适当的数据识别这些表?
Thanks!
谢谢!
采纳答案by RC.
No guarantees, but you may want to look at: https://launchpad.net/percona-data-recovery-tool-for-innodb
没有保证,但你可能想看看: https://launchpad.net/percona-data-recovery-tool-for-innodb
回答by longneck
even when you use table namespaces, the ibdata1 file still contains data that those namespaces depend on, such as the multiversion index number and the transaction log. you can't just delete that file and expect it to work.
即使您使用表命名空间,ibdata1 文件仍包含这些命名空间所依赖的数据,例如多版本索引号和事务日志。您不能只是删除该文件并期望它起作用。
if you're extremely lucky, you can restore/undelete the ibdata1 file and start mysql with the --innodb_force_recovery=3 option. this will allow mysql to start without attempting to rollback/rollforward any transactions.
如果您非常幸运,您可以恢复/取消删除 ibdata1 文件并使用 --innodb_force_recovery=3 选项启动 mysql。这将允许 mysql 在不尝试回滚/前滚任何事务的情况下启动。
if you still hav eproblems, you need to post your mysql server log from startup.
如果你仍然有问题,你需要从启动时发布你的mysql服务器日志。