mysql崩溃并丢失了表格描述“show table status”all null

由于空调故障,SAN与我们的mysql数据库文件崩溃。

当查询出现问题需要花费很长时间才能运行,进一步的调查显示* .frm文件被破坏;

mysql> show table status; +-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------+----------+----------------+----------------------------------------------------------------------------------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment | +-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------+----------+----------------+----------------------------------------------------------------------------------+ | STATUS_REPORT | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Incorrect information in file: './discovery_prod/STATUS_REPOR | | bp_discovery | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Table './discovery_prod/bp_discovery' is marked as crashed and last | | bp_feedbacks | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Incorrect information in file: './discovery_prod/bp_feedbacks.frm' | | bp_language_code_master | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Incorrect information in file: './discovery_prod/bp_language_code_ma 

也试图比较似乎证实了这一点;

 [root@db01 discovery_prod]# mysqlcheck -hlocalhost -r discovery_prod discovery_prod.STATUS_REPORT error : Incorrect information in file: './discovery_prod/STATUS_REPORT.frm' 

修复表SOMETABLE输出如下;

  mysql> repair table STATUS_REPORT; +-------------------------------------------------+--------+----------+----------------------------------------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +-------------------------------------------------+--------+----------+----------------------------------------------------------------------------------------+ | discovery_prod.STATUS_REPORT | repair | error | Incorrect information in file: './discovery_prod/STATUS_REPORT.frm' | +-------------------------------------------------+--------+----------+----------------------------------------------------------------------------------------+ 1 row in set, 1 warning (0.00 sec) 

有没有可能从数据文件恢复frm文件? 有没有可以反向工作的实用程序,因为数据库已经启动并提供查询服务? 真的很慢

你试过运行repair table $TABLENAME; ? 这可能会解决有关bp_discovery任何问题。

.frm文件包含表定义,架构。 如果你正在使用MyISAM引擎并且知道你的模式,一个潜在的最后的解决scheme如下:

  • 备份所有/data/$TABLENAME.*文件
  • 放下桌子
  • 重新创build表格。
  • 删除$TABLENAME.MYD$TABLENAME.MYI文件,并将您的备份复制到位。
  • validation表格状态

在这一点上,你应该认真考虑从备份恢复。