SqlServer 查詢死鎖,殺死死鎖進程


-- 查詢死鎖
select    
    request_session_id spid,   
    OBJECT_NAME(resource_associated_entity_id) tableName    
from    
    sys.dm_tran_locks   
where    
    resource_type='OBJECT' 
 --殺死死鎖進程
kill 354 

 創造死鎖條件

開兩個查詢窗口

BEGIN TRANSACTION--開始事務

update   job  set creator='00000'  where id='001'

WAITFOR DELAY '02:00'; 
select * from job where id='001'

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM