SQL 事务隔离学习
时间:2021-07-01 10:21:17
帮助过:2人阅读
select --*
2 request_session_id
as spid,
3 resource_type
as restype,
4 resource_database_id
as dbid,
5 DB_NAME(resource_database_id)
as dbname,
6 resource_description
as res,
7 resource_associated_entity_id
as resid,
8 case when resource_type
= ‘OBJECT‘ then OBJECT_NAME( resource_associated_entity_id )
9 end
10 as objectName,
11 request_mode
as mode,
12 request_status
as status
13 from sys.dm_tran_locks
14
15
16 select --*
17 session_id
as spid,
18 connect_time,
19 last_read,
20 last_write,
21 most_recent_sql_handle,
22 text
23 from sys.dm_exec_connections
24 cross apply sys.dm_exec_sql_text(most_recent_sql_handle)
--as a
25 where session_id
in (
56,
57)
26
27 select --*
28 session_id
as spid,
29 login_time,
30 host_name,
31 program_name,
32 login_name,
33 nt_user_name,
34 last_request_start_time,
35 last_request_end_time
36 from sys.dm_exec_sessions
37 where session_id
in (
56,
57)
38
39 select --*
40 [session_id],
41 [blocking_session_id],
42 [command],
43 [sql_handle],
44 text,
45 [database_id],
46 [wait_type],
47 [wait_time],
48 [wait_resource]
49 from sys.dm_exec_requests
50 cross apply sys.dm_exec_sql_text(
[sql_handle])
51 where blocking_session_id
>0
SQL 事务隔离学习
标签: