SQL Server 监控锁定信息
查看当前数据库锁定信息:
declare @tba TABLE
(spid int,dbid INT,objectid INT,
indld INT,TYPE VARCHAR(20),resource VARCHAR(50),mode VARCHAR(20),status VARCHAR(10))
insert into @tba exec sp_lock
select spid,OBJECT_name(objectid) tab,TYPE,resource,mode,status from @tba WHERE dbid=DB_ID()
and OBJECT_name(objectid)<>''
ORDER BY 2
(spid int,dbid INT,objectid INT,
indld INT,TYPE VARCHAR(20),resource VARCHAR(50),mode VARCHAR(20),status VARCHAR(10))
insert into @tba exec sp_lock
select spid,OBJECT_name(objectid) tab,TYPE,resource,mode,status from @tba WHERE dbid=DB_ID()
and OBJECT_name(objectid)<>''
ORDER BY 2