今天在SSMS(Microsoft SQL Server Management Studio)里面,点击左侧的资源管理器,查看数据库对应的表的时候,会遇到“Lock Request time out period exceeded.(Microsoft SQL Server, 错误1222)”,对应的中文错误提示为“已超过了锁请求超时时段。 (Microsoft SQL Server,错误: 1222)”。
这是死锁引起的,执行以下语句
select *
from master..SysProcesses
where db_Name(dbID) = '数据库名'
and spId <> @@SpId
and dbID <> 0
and blocked >0;
得到结果:
?
| spid |
kpid |
blocked |
| 59 |
760 |
339 |
| 95 |
26224 |
285 |
| 225 |
27444 |
285 |
| 285 |
7248 |
339 |
| 318 |
-31804 |
285 |
可知都是因为339进程引起死锁,执行语句kill 339后即恢复正常。