MySQL 表不存在

MySQL 表不存在

我在 err 文件中收到以下错误。

110803  6:51:26  InnoDB: Error: table `ims`.`temp_discoveryjobdetails` already exists in InnoDB internal
InnoDB: data dictionary. Have you deleted the .frm file
InnoDB: and not used DROP TABLE? Have you used DROP DATABASE
InnoDB: for InnoDB tables in MySQL version <= 3.23.43?
InnoDB: See the Restrictions section of the InnoDB manual.
InnoDB: You can drop the orphaned table inside InnoDB by
InnoDB: creating an InnoDB table with the same name in another
InnoDB: database and copying the .frm file to the current database.
InnoDB: Then MySQL thinks the table exists, and DROP TABLE will
InnoDB: succeed.
InnoDB: You can look for further help from
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html

当我执行相同操作时,例如将 frm 文件从其他数据库复制到此处并删除表,出现以下错误,

InnoDB: Error: trying to load index PRIMARY for table ims/temp_discoveryjobdetails
InnoDB: but the index tree has been freed!
110803  6:50:26  InnoDB: Error: table `ims`.`temp_discoveryjobdetails` does not exist in the InnoDB internal
InnoDB: data dictionary though MySQL is trying to drop it.
InnoDB: Have you copied the .frm file of the table to the
InnoDB: MySQL database directory from another database?
InnoDB: You can look for further help from
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html

请任何人帮助我解决这个问题。还有谁能告诉我为什么会出现这个错误。

编辑:

仅当磁盘空间已满并且我们使用 Truncate table 时才会发生此问题。此外,此问题仅发生在 5.1 版本中,而不会发生在 5.0 版本中。

答案1

试过这个吗?http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting-datadict.html

表的一个具体问题是,MySQL 服务器将数据字典信息保存在数据库目录中的 .frm 文件中,而 InnoDB 还将信息存储在表空间文件内自己的数据字典中。如果您移动 .frm 文件,或者服务器在数据字典操作过程中崩溃,.frm 文件的位置可能最终与 InnoDB 内部数据字典中记录的位置不同步。

相关内容