Purpose
You can use this statement to check whether a view or table exists in the database or whether objects referenced in a view are valid.
The CHECK TABLE statement returns a result set with the following columns:
Table: the name of the table being checked.Op: specifies to perform a check. The value is alwayscheck.Msg_type: the message type. The value is generallystatus, which indicates status information. Valid values:status: indicates a status.error: indicates an error.info: indicates information.note: indicates a comment.warning: indicates a warning.
Msg_text: the details about the check result. The value is generallyOK, which indicates that the check result is normal without problems.
Required privileges
To execute the CHECK TABLE statement, you must have the SELECT privilege on the table. For more information about privileges in OceanBase Database, see Privilege types in MySQL mode.
Syntax
CHECK TABLE table_name_list [check_option_list];
table_name_list:
table_name [, table_name ...]
check_option_list:
check_option [check_option ...]
check_option:
FOR UPGRADE
| QUICK
| FAST
| MEDIUM
| EXTENDED
| CHANGED
Parameters
| Parameter | Description |
|---|---|
| table_name | The name of the table to be checked. If you specify multiple tables, separate the table names with commas (,). |
| check_option_list | Optional. A check option for further check. You can specify multiple check options.
NoticeIn the current version, only the check option syntax is supported. The functionality does not actually take effect. |
Examples
Check whether the test_tbl1 table exists.
obclient [test]> CHECK TABLE test_tbl1;
The return result is as follows:
+----------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+----------------+-------+----------+----------+
| test.test_tbl1 | check | status | OK |
+----------------+-------+----------+----------+
1 row in set