组复制表设计强制要求:
- InnoDB存储引擎:数据必须存储在InnoDB事务存储引擎中。
- 主键:组要复制的每个表都必须定义显式主键。
1、首先检查表存储引擎,要全部为innodb引擎
SELECT table_schema, table_name, engine, table_rows,
(index_length+data_length)/1024/1024 AS sizeMB
FROM information_schema.tables
WHERE engine != 'innodb'
AND table_schema NOT IN
('information_schema', 'mysql', 'performance_schema');
2、有没有有效的组复制设计的表 ,没有主键的表 结果要为空
SELECT tables.table_schema , tables.table_name , tables.engine
FROM information_schema.tables
LEFT JOIN (
SELECT table_schema , table_name
FROM information_schema.statistics
GROUP BY table_schema, table_name, index_name HAVING
SUM( case when non_unique = 0 and nullable != 'YES' then 1 else 0 end ) = count(*) ) puks
ON tables.table_schema = puks.table_schema and tables.table_name = puks.table_name
WHERE puks.table_name is null
AND tables.table_type = 'BASE TABLE' AND Engine="InnoDB";