全部产品
云市场

CHECK TABLE

更新时间:2018-04-27 22:10:21

对数据表进行检查,主要用于 DDL 建表失败的情形。

  • 对于拆分表,检查底层物理分表是否有缺失的情况,底层的物理分表的列和索引是否是一致;
  • 对于单库单表,检查表是否存在。

语法:

  1. CHECK TABLE tbl_name
  1. mysql> check table tddl_mgr_log;
  2. +------------------------+-------+----------+----------+
  3. | TABLE | OP | MSG_TYPE | MSG_TEXT |
  4. +------------------------+-------+----------+----------+
  5. | TDDL5_APP.tddl_mgr_log | check | status | OK |
  6. +------------------------+-------+----------+----------+
  7. 1 row in set (0.56 sec)
  8. mysql> check table tddl_mg;
  9. +-------------------+-------+----------+----------------------------------------+
  10. | TABLE | OP | MSG_TYPE | MSG_TEXT |
  11. +-------------------+-------+----------+----------------------------------------+
  12. | TDDL5_APP.tddl_mg | check | Error | Table 'tddl5_00.tddl_mg' doesn't exist |
  13. +-------------------+-------+----------+----------------------------------------+
  14. 1 row in set (0.02 sec)