首頁 >資料庫 >mysql教程 >查看sqlserver被锁的表以及如何解锁

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-06-07 15:40:591418瀏覽

查看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)

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn