SQL 2005 잠 금 저장 프로시저 보기 spwho_lock
                                            
 1940 단어  자물쇠sp who lock
                    
호출 방법:해당 데이터 베 이 스 를 선택 하고 exec sp 를 실행 합 니 다.who_lock
USE [master]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[sp_who_lock] 
as 
begin 
declare @spid int, @bl int, @intTransactionCountOnEntry int, @intRowcount int, @intCountProperties int, @intCounter int 
create table #tmp_lock_who ( 
	id int identity(1,1), 
	spid smallint, 
	bl smallint
) 
IF @@ERROR<>0 RETURN @@ERROR 
insert into #tmp_lock_who(spid,bl) select 0 ,blocked 
	from (select * from sysprocesses where blocked>0 ) a 
	where not exists(select * from (select * from sysprocesses where blocked>0 ) b 
	where a.blocked=spid) 
	union select spid,blocked from sysprocesses where blocked>0 
IF @@ERROR<>0 RETURN @@ERROR 
 
--           
select @intCountProperties = Count(*),@intCounter = 1 
from #tmp_lock_who 
IF @@ERROR<>0 RETURN @@ERROR 
if @intCountProperties=0 
	select '           ' as message 
--      
while @intCounter <= @intCountProperties 
begin 
	--        
	select @spid = spid,@bl = bl 
	from #tmp_lock_who where Id = @intCounter 
	begin 
		if @spid =0 
      select '         : '+ CAST(@bl AS VARCHAR(10)) + '   ,    SQL    ' 
		else 
      select '   SPID:'+ CAST(@spid AS VARCHAR(10))+ ' ' + '   SPID:'+ CAST(@bl AS VARCHAR(10)) +'  ,        SQL    ' 
		DBCC INPUTBUFFER (@bl ) 
	end 
	--        
	set @intCounter = @intCounter + 1 
end 
drop table #tmp_lock_who 
return 0 
end
                이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
java 자물쇠의 성능 향상 방법사실상 경쟁적이지 않은 상황에서 대부분의 응용 프로그램에서 JVM은 동기화에 최적화되었다.비경쟁 자물쇠는 실행 과정에서 어떠한 추가 비용도 가져오지 않는다.따라서 성능 문제로 자물쇠를 원망해서는 안 되고, 자물쇠의 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.