You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/relational-databases/system-dynamic-management-views/sys-dm-tran-locks-transact-sql.md
+7-12Lines changed: 7 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ ms.workload: "On Demand"
36
36
The columns in the result set are divided into two main groups: resource and request. The resource group describes the resource on which the lock request is being made, and the request group describes the lock request.
37
37
38
38
> [!NOTE]
39
-
> To call this from [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)] or [!INCLUDE[ssPDW](../../includes/sspdw-md.md)], use the name **sys.dm_pdw_nodes_tran_locks**.
39
+
> To call this from [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)] or [!INCLUDE[ssPDW](../../includes/sspdw-md.md)], use the name **sys.dm_pdw_nodes_tran_locks**.
On [!INCLUDE[ssNoVersion_md](../../includes/ssnoversion-md.md)], requires `VIEW SERVER STATE` permission.
66
66
On [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)] Premium Tiers, requires the `VIEW DATABASE STATE` permission in the database. On [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)] Standard and Basic Tiers, requires the **Server admin** or an **Azure Active Directory admin** account.
67
67
68
-
69
-
70
68
## Remarks
71
69
A granted request status indicates that a lock has been granted on a resource to the requestor. A waiting request indicates that the request has not yet been granted. The following waiting-request types are returned by the **request_status** column:
72
70
@@ -290,7 +288,7 @@ On [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)] Premium Tiers, requires the
290
288
### A. Using sys.dm_tran_locks with other tools
291
289
The following example works with a scenario in which an update operation is blocked by another transaction. By using **sys.dm_tran_locks** and other tools, information about locking resources is provided.
292
290
293
-
```
291
+
```sql
294
292
USE tempdb;
295
293
GO
296
294
@@ -328,7 +326,7 @@ BEGIN TRAN
328
326
329
327
The following query will display lock information. The value for `<dbid>` should be replaced with the **database_id** from **sys.databases**.
The following query will show blocking information.
348
346
349
-
```
347
+
```sql
350
348
SELECT
351
349
t1.resource_type,
352
350
t1.resource_database_id,
@@ -361,7 +359,7 @@ SELECT
361
359
362
360
Release the resources by rolling back the transactions.
363
361
364
-
```
362
+
```sql
365
363
-- Session 1
366
364
ROLLBACK;
367
365
GO
@@ -374,7 +372,7 @@ GO
374
372
### B. Linking session information to operating system threads
375
373
The following example returns information that associates a session ID with a Windows thread ID. The performance of the thread can be monitored in the Windows Performance Monitor. This query does not return session IDs that are currently sleeping.
[Dynamic Management Views and Functions (Transact-SQL)](~/relational-databases/system-dynamic-management-views/system-dynamic-management-views.md)
387
+
[Dynamic Management Views and Functions (Transact-SQL)](../../relational-databases/system-dynamic-management-views/system-dynamic-management-views.md)
390
388
[Transaction Related Dynamic Management Views and Functions (Transact-SQL)](../../relational-databases/system-dynamic-management-views/transaction-related-dynamic-management-views-and-functions-transact-sql.md)
0 commit comments