开发者社区 问答 正文

PolarDB执行DML语句时报错

已解决

PolarDB执行DML语句时报错

展开
收起
提个问题 2024-06-08 11:06:01 40 分享 版权
1 条回答
写回答
取消 提交回答
  • 开发者社区问答官方账号
    官方回答
    采纳回答
    1.查询是否有锁表/库 show open tables where in_use > 0; -- 有多少线程正在使用某张表 show open tables where name_locked > 0; -- 是否有被锁 show open tables from 库名; -- 针对每一个库。 show open tables; -- 针对所有的库。 
    2.查进程 show processlist; 找到有锁的进程 ID,杀掉: kill 6; kill 7; 
    3.查看正在锁的事务(被锁的) select * from information_schema.innodb_trx; -- 查看 trx_mysql_thread_id,根据这个 ID 处理锁。kill 13; select * from information_schema.innodb_locks; 
    4.查看等待锁的事务(可以找到源头,锁人的) select * from information_schema.innodb_lock_waits; -- 10018 select * from information_schema.innodb_trx where trx_id=10018; -- kill 11; trx_mysql_thread_id ,杀源头,会回滚事务,一定要注意了。

    如果上述监测完成,没有明显异常的话,可参考通过无锁变更工单实现无锁结构变更
    2024-06-08 11:06:02
    赞同 展开评论