??????μ??????????????к?????

??????????????????????????????????????????“???”??“??????”

????1???????????????????е?????

???????????sp_lock??????????????е??????????

??????2005????????DMV???????ù?sys.dm_tran_locks??????


SELECT  request_session_id??
        resource_type ??
        resource_associated_entity_id ??
        request_status ??
        request_mode ??
        resource_description
FROM    sys.dm_tran_locks


????????????????DMV??????????????


SELECT  request_session_id??
        resource_type ??
        resource_associated_entity_id ??
        request_status ??
        request_mode ??
        resource_description ??
        p.object_id ??
        OBJECT_NAME(p.object_id) AS OBJECT_NAME ??
        p.*
FROM    sys.dm_tran_locks a
LEFT JOIN sys.partitions p ON a.resource_associated_entity_id = p.hobt_id
WHERE   resource_database_id= DB_ID('???????')
ORDER BY request_session_id??resource_type ??
resource_associated_entity_id


????2???????????й?????SQL Server???????????????????

?????????к??????????????й?????????????????????????????????????????淽???????????????SQL Server Profiler ????????????????

??????SQL Server Profiler→????????????trace?????????μ?Events?????????Lock:Accquired??Lock:Released

??????????????????????????????????????????????????????????????????С?

???????????????DMV??sp_lock??????????????????

???????????????????????????

?????????????SELECT??????????????

??????1????????A?У??????????????ɡ????????????repeatable read??

??????2???????в??????????????

??????3?????в???????????

??????4?????????????????sys.dm_tran_locks?з?????????????????A?????е?????

?????????????UPDATE??????????????

???????????UPDATE??????????????????????????????????????S?????????????????U????????U????????X????

???????update??????????????????????????????????????U??????????????????????????????????????X???????????漰????檔SQL SERVER????IU??????????????棬????IX????