当前位置:网站首页>1205 Lock wait timeout exceeded; try restarting transaction处理
1205 Lock wait timeout exceeded; try restarting transaction处理
2022-07-26 01:52:00 【讓丄帝愛伱】
1205 - Lock wait timeout exceeded; try restarting transaction
解决:
select * from information_schema.innodb_trx; -- 找到了那个一直没有提交的只读事务
kill thread id; -- 对应的线程后
MySQL 5.5 – innodb_lock_wait 锁 等待
以前,当出现:ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction,
要解决是一件麻烦的事情 ;
特别是当一个SQL执行完了,但未COMMIT,后面的SQL想要执行就是被锁,超时结束;
DBA光从数据库无法着手找出源头是哪个SQL锁住了;
有时候看看show engine innodb status, 并结合show full processlist;能暂时解决问题;但一直不能精确定位;
在5.5中,information_schema 库中增加了三个关于锁的表(MEMORY引擎);
innodb_trx ## 当前运行的所有事务
innodb_locks ## 当前出现的锁
innodb_lock_waits ## 锁等待的对应关系
来看一下表结构
desc information_schema .innodb_locks;
+-------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+---------+-------+
| lock_id | varchar(81) | NO | | | |#锁ID
| lock_trx_id | varchar(18) | NO | | | |#拥有锁的事务ID
| lock_mode | varchar(32) | NO | | | |#锁模式
| lock_type | varchar(32) | NO | | | |#锁类型
| lock_table | varchar(1024) | NO | | | |#被锁的表
| lock_index | varchar(1024) | YES | | NULL | |#被锁的索引
| lock_space | bigint(21) unsigned | YES | | NULL | |#被锁的表空间号
| lock_page | bigint(21) unsigned | YES | | NULL | |#被锁的页号
| lock_rec | bigint(21) unsigned | YES | | NULL | |#被锁的记录号
| lock_data | varchar(8192) | YES | | NULL | |#被锁的数据
+-------------+---------------------+------+-----+---------+-------+
desc information_schema .innodb_lock_waits;
+-------------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+-------------+------+-----+---------+-------+
| requesting_trx_id | varchar(18) | NO | | | |#请求锁的事务ID
| requested_lock_id | varchar(81) | NO | | | |#请求锁的锁ID
| blocking_trx_id | varchar(18) | NO | | | |#当前拥有锁的事务ID
| blocking_lock_id | varchar(81) | NO | | | |#当前拥有锁的锁ID
+-------------------+-------------+------+-----+---------+-------+
desc information_schema .innodb_trx ;
+----------------------------+---------------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------+---------------------+------+-----+---------------------+-------+
| trx_id | varchar(18) | NO | | | |#事务ID
| trx_state | varchar(13) | NO | | | |#事务状态:
| trx_started | datetime | NO | | 0000-00-00 00:00:00 | |#事务开始时间;
| trx_requested_lock_id | varchar(81) | YES | | NULL | |#innodb_locks.lock_id
| trx_wait_started | datetime | YES | | NULL | |#事务开始等待的时间
| trx_weight | bigint(21) unsigned | NO | | 0 | |#
| trx_mysql_thread_id | bigint(21) unsigned | NO | | 0 | |#事务线程ID
| trx_query | varchar(1024) | YES | | NULL | |#具体SQL语句
| trx_operation_state | varchar(64) | YES | | NULL | |#事务当前操作状态
| trx_tables_in_use | bigint(21) unsigned | NO | | 0 | |#事务中有多少个表被使用
| trx_tables_locked | bigint(21) unsigned | NO | | 0 | |#事务拥有多少个锁
| trx_lock_structs | bigint(21) unsigned | NO | | 0 | |#
| trx_lock_memory_bytes | bigint(21) unsigned | NO | | 0 | |#事务锁住的内存大小(B)
| trx_rows_locked | bigint(21) unsigned | NO | | 0 | |#事务锁住的行数
| trx_rows_modified | bigint(21) unsigned | NO | | 0 | |#事务更改的行数
| trx_concurrency_tickets | bigint(21) unsigned | NO | | 0 | |#事务并发票数
| trx_isolation_level | varchar(16) | NO | | | |#事务隔离级别
| trx_unique_checks | int(1) | NO | | 0 | |#是否唯一性检查
| trx_foreign_key_checks | int(1) | NO | | 0 | |#是否外键检查
| trx_last_foreign_key_error | varchar(256) | YES | | NULL | |#最后的外键错误
| trx_adaptive_hash_latched | int(1) | NO | | 0 | |#
| trx_adaptive_hash_timeout | bigint(21) unsigned | NO | | 0 | |#
+----------------------------+---------------------+------+-----+---------------------+-------
select * from information_schema.innodb_lock_waits G
边栏推荐
- Y77. Chapter IV Prometheus' monitoring system and practice -- Prometheus' service discovery mechanism (VIII)
- I just test it
- 3、 Pinda general permission system__ pd-tools-swagger2
- win下搭建嵌入式开发环境及frp穿透
- [in simple terms, play with FPGA learning 11 --- testbench writing skills 1]
- [Verilog digital system design (Xia Yuwen) 4 ----- basic concepts of Verilog syntax 2]
- Mark and lightbulbs (thinking)
- Network layer 2 and layer 3 forwarding
- "Weilai Cup" 2022 Niuke summer multi school training camp 2 k.[link with bracket sequence i] bracket sequence DP
- Travel (split points and layers)
猜你喜欢

Worthington核酸酶、微球菌相关研究及测定方案

The sales volume has won the championship repeatedly. Is the secret of Wuling's success only low price?

网络之IP地址

AUTOCAD——计算面积的方法
![[independent station construction] Shopify seller: learn these points and double the sales volume of online stores!](/img/52/8c1520db38ffa8927e975b6f244a65.png)
[independent station construction] Shopify seller: learn these points and double the sales volume of online stores!

How to display numbers / English time in Excel

Worthington木瓜蛋白酶丨从纯化的蛋白聚糖生产糖肽(附文献)

P3166 number triangle (tolerance and exclusion +gcd)

Pt onnx ncnn conversion problem record (followed by yolov5 training)

图像批处理高斯滤波降噪+峰值信噪比计算
随机推荐
[in simple terms, play with FPGA learning 11 --- testbench writing skills 2]
What is cross site scripting (XSS)?
Stack Title: basic calculator
Dataframe modifies the value of a row or column position
登堂入室soc之arm汇编基础
E2. escape the maze (hard version)
Is it safe to open an account for stock speculation through the online account manager?
excel中怎么显示数字/英文时间
给RestTemplate添加拦截器记录请求响应,还需解决流只读一次的问题
y77.第四章 Prometheus大厂监控体系及实战 -- prometheus的服务发现机制(八)
Codisvsrediscluster: which cluster scheme should I choose?
Niuke - bm39 serialized binary tree [hard]
劳驾问一下各位老师 oracle 到pg cdc oracle 那边字段大写 pg 这边小写 同
Cross Site Request Forgery (CSRF): impact, examples, and Prevention
flutter 下 grpc list没有Setter 方法 ,如何使用相关属性
C# 迭代器的实现
Spark-SQL中根据年月日显示周几用date_format(date,‘u‘)
软件加群验证
Excuse me, sir. Oracle to PG CDC Oracle, the upper case of the field is the same as that of PG
Go operation excel library excel use