Sqlserver?????????????????
???????????? ???????[ 2015/3/27 14:04:41 ] ????????????? SQL Server
????????????????????
????????????
????SELECT*FROMtableWITH(HOLDLOCK)
???????:????????????????????
????????????
????SELECT*FROMtableWITH(HOLDLOCK)
????????????????????????????????
????????????
????SELECT*FROMtableWITH(TABLOCKX)
??????????????????????o????
????SELECT?????“???????”????????
????SQLServer??????????????????????????????????????????????????????????SQLServer???????????????select????????“???????”?????????Ч?????????????SELECT????е????“???????”??????????????
?????????????
????????????
????selectrequest_session_idspid??OBJECT_NAME(resource_associated_entity_id)tableName
????fromsys.dm_tran_lockswhereresource_type='OBJECT'
????spid???????
????tableName????????
????[@more@]
??????????
????1.??????????Table
????????????
????CREATETABLE#HarveyLock
????(
????SPIDINT??
????DBIDINT??
????OBJIDINT??
????INDIDINT??
????TYPEVARCHAR(100)??
????RESOURCEVARCHAR(100)??
????MODEVARCHAR(100)??
????STATUSVARCHAR(100)
????)
????2.??Lock????????Table
????INSERTINTO#HarveyLockEXECSP_LOCK
????3.??Table????????????????LOCK
????SELECT*FROM#HarveyLock
????4.KILL???LOCK
????KILL@SPID
??????
????????????
????declare@spidint
????Set@spid=57--???????
????declare@sqlvarchar(1000)
????set@sql='kill'+cast(@spidasvarchar)
????exec(@sql)
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11