Home >Database >Mysql Tutorial >查看sqlserver被锁的表以及如何解锁

查看sqlserver被锁的表以及如何解锁

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:40:591424browse

查看sqlserver被锁的表: select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT' 解锁: declare @spid int Set @spid = 66 --锁表进程 declare @sql varchar(1000) s

查看sqlserver被锁的表:

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

解锁:

declare @spid int
Set @spid = 66 --锁表进程
declare @sql varchar(1000)
set @sql='kill '+cast(@spid as varchar)
exec(@sql)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Python 学习入门(4) 连接MySQLNext article:MySQL-Proxy