例表:t_table,表中无数据。
生产环境下( MySQL )这个表一切正常,我本地环境下( MariaDB 10.4.10-MariaDB-log )都出现好几次表无缘无故消失不见(只剩 .ibd 文件,.frm 文件消失了)。
表结构如下:
CREATE TABLE `t_table` ( `id` char(36) NOT NULL, `assem_ref` varchar(20) NOT NULL, `as_id` char(36) NOT NULL, `goods_id` char(36) NOT NULL, `period` varchar(20) NOT NULL DEFAULT '', `in_date` date DEFAULT NULL, `in_pici` varchar(20) NOT NULL, `in_count` int(20) unsigned NOT NULL, `in_count_total` int(20) unsigned NOT NULL, `cost_price` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_material` decimal(18,2) unsigned NOT NULL, `cost_labor` decimal(18,2) unsigned NOT NULL, `cost_prod` decimal(18,2) unsigned NOT NULL', `input_user_id` char(36) NOT NULL, `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` datetime DEFAULT NULL, `cost_fuli` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_power` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_low_value` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_house` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_depr` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_leasing` decimal(18,2) NOT NULL, `cost_soft` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_dev` decimal(18,2) NOT NULL DEFAULT '0.00', `cost_init_material` decimal(18,2) NOT NULL DEFAULT '0.00', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; 当用 drop table t_table 时,提示:Unknown table 't_table',但是在数据目录下还有 t_table.ibd 文件存在,对应的 .ifm 消失了。
删除 t_table.ibd 文件后,重新建表时又提示:Table 't_table' already exists,t_table.ibd 文件自动恢复了、、
大家有遇到这种情况吗?求解是什么导致的,因为只有这一张表隔三差五出现这个问题。
