点关注不迷路

Max

数据库锁表问题

sqlserver解决锁表问题:

select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type='OBJECT'

spid:进程Id;tableName :被锁表名; 解决:kill spid

mysql 中解决锁表问题:

查看哪些表被锁了:

show OPEN TABLES where In_use > 0;

查看锁表的进程

SELECT * FROM information_schema.innodb_trx;

查看所有进程

show processlist;

删出进程

kill 1085850;
posted @ 2019-05-09 17:06  Max麦克斯  阅读(183)  评论(0编辑  收藏  举报