Skip to content

Commit e19917a

Browse files
committed
Refresh articles relating to NOLOCK
1 parent 0ce2494 commit e19917a

3 files changed

Lines changed: 173 additions & 159 deletions

File tree

docs/relational-databases/errors-events/mssqlserver-1205-database-engine-error.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,46 @@ title: "MSSQLSERVER_1205"
33
description: "MSSQLSERVER_1205"
44
author: MashaMSFT
55
ms.author: mathoma
6-
ms.date: "04/04/2017"
6+
ms.reviewer: randolphwest
7+
ms.date: 12/16/2024
78
ms.service: sql
89
ms.subservice: supportability
910
ms.topic: "reference"
1011
helpviewer_keywords:
1112
- "1205 (Database Engine error)"
1213
---
1314
# MSSQLSERVER_1205
15+
1416
[!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)]
15-
16-
## Details
17-
18-
| Attribute | Value |
19-
| :-------- | :---- |
20-
|Product Name|SQL Server|
21-
|Event ID|1205|
22-
|Event Source|MSSQLSERVER|
23-
|Component|SQLEngine|
24-
|Symbolic Name|LK_VICTIM|
25-
|Message Text|Transaction (Process ID %d) was deadlocked on %.*ls resources with another process and has been chosen as the deadlock victim. Rerun the transaction.|
26-
17+
18+
## Details
19+
20+
| Attribute | Value |
21+
| :--- | :--- |
22+
| Product Name | SQL Server |
23+
| Event ID | 1205 |
24+
| Event Source | MSSQLSERVER |
25+
| Component | SQLEngine |
26+
| Symbolic Name | LK_VICTIM |
27+
| Message Text | Transaction (Process ID %d) was deadlocked on %.*ls resources with another process and has been chosen as the deadlock victim. Rerun the transaction. |
28+
2729
## Explanation
2830

29-
Resources are accessed in conflicting order on separate transactions, causing a [deadlock](../sql-server-transaction-locking-and-row-versioning-guide.md?#deadlocks). For example:
30-
31-
- Transaction1 updates **Table1.Row1**, while Transaction2 updates **Table2.Row2**
32-
- Transaction1 tries to update **Table2.Row2** but is blocked because Transaction2 hasn't yet committed and hasn't released its locks
33-
- Transaction2 now tries to update **Table1.Row1** but is blocked because Transaction1 hasn't committed and hasn't released its locks
34-
- A deadlock occurs because Transaction1 is waiting for Transaction2 to complete, but Transaction2 is waiting for Transaction1 to complete.
35-
36-
The system will detect this deadlock and will choose one of the transactions involved as a 'victim'. It will then issue this error message, rolling back the victim's transaction. For detailed information, see [Deadlocks](../sql-server-transaction-locking-and-row-versioning-guide.md?#deadlocks).
31+
Resources are accessed in conflicting order on separate transactions, causing a [deadlock](../sql-server-transaction-locking-and-row-versioning-guide.md?#deadlocks). For example:
32+
33+
- `Transaction1` updates `Table1.Row1`, while Transaction2 updates `Table2.Row2`
34+
- `Transaction1` tries to update `Table2.Row2` but is blocked because `Transaction2` hasn't yet committed and hasn't released its locks
35+
- Transaction2 now tries to update `Table1.Row1` but is blocked because `Transaction1` hasn't committed and hasn't released its locks
36+
- A deadlock occurs because `Transaction1` is waiting for `Transaction2` to complete, but `Transaction2` is waiting for `Transaction1` to complete.
37+
38+
The system detects this deadlock and chooses one of the transactions involved as a *victim*. It then issues this error message, rolling back the victim's transaction. For detailed information, see [Deadlocks](../sql-server-transaction-locking-and-row-versioning-guide.md?#deadlocks).
3739

40+
## User action
3841

42+
Deadlocks are in most cases application-related issues and require application developers to make code changes. One approach when you receive error 1205 is to execute the queries again. For more information, see [Deadlock Simulator app for Developers: How to Handle a SQL Deadlock issue in Your App](https://techcommunity.microsoft.com/blog/sqlserversupport/deadlock-simulator-app-for-developers-how-to-handle-a-sql-deadlock-issue-in-your/334019).
3943

40-
## User Action
44+
You can also revise the application to avoid deadlocks. The transaction that was chosen as a victim can be retried and likely succeeds, depending on what operations are being executed simultaneously.
4145

42-
Deadlocks are in most cases application-related issues and require application developers to make code changes. One approach when you receive error 1205 is to execute the queries again. See this blog for an example of how to retry - handle the deadlock and re-execute the query: [Deadlock Simulator app for Developers: How to Handle a SQL Deadlock issue in Your App](https://techcommunity.microsoft.com/t5/sql-server-support-blog/deadlock-simulator-app-for-developers-how-to-handle-a-sql/ba-p/334019)
46+
To prevent or avoid deadlocks from occurring, consider having all transactions access rows in the same order (`Table1`, then `Table2`). This way, although blocking might occur, a deadlock is avoided.
4347

44-
You can also revise the application to avoid deadlocks. The transaction that was chosen as a victim can be retried and will likely succeed, depending on what operations are being executed simultaneously.
45-
46-
To prevent or avoid deadlocks from occurring, consider having all transactions access rows in the same order (**Table1**, then **Table2**). This way, although blocking might occur, a deadlock will be avoided.
47-
4848
For more information, see [Handling Deadlocks](../sql-server-deadlocks-guide.md?#handle-deadlocks) and [Minimizing Deadlocks](../sql-server-deadlocks-guide.md#minimize-deadlocks).

docs/relational-databases/errors-events/mssqlserver-601-database-engine-error.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: "MSSQLSERVER_601"
33
description: "MSSQLSERVER_601"
44
author: MashaMSFT
55
ms.author: mathoma
6-
ms.date: "04/04/2017"
6+
ms.reviewer: randolphwest
7+
ms.date: 12/16/2024
78
ms.service: sql
89
ms.subservice: supportability
910
ms.topic: "reference"
@@ -13,30 +14,33 @@ helpviewer_keywords:
1314
- "601 (Database Engine error)"
1415
---
1516
# MSSQLSERVER_601
16-
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
17-
18-
## Details
19-
20-
| Attribute | Value |
21-
| :-------- | :---- |
22-
|Product Name|SQL Server|
23-
|Event ID|601|
24-
|Event Source|MSSQLSERVER|
25-
|Component|SQLEngine|
26-
|Symbolic Name||
27-
|Message Text|Could not continue scan with NOLOCK due to data movement.|
28-
29-
## Explanation
30-
The [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)] cannot continue executing the query because it is trying to read data that was updated or deleted by another transaction. The query is using either the NOLOCK locking hint or the READ UNCOMMITTED transaction isolation level.
31-
32-
Typically, access to data that is being changed by another transaction is denied because of locks put on the data. However, the NOLOCK locking hint and READ UNCOMMITTED transaction isolation level let a query read data that is locked by another transaction. This is referred to as a dirty read because you can read values that have not yet been committed and that are subject to change.
33-
34-
## User Action
35-
This error cancels the query. Either resubmit the query or remove the NOLOCK locking hint.
36-
37-
## See Also
38-
[MSSQLSERVER_605](../../relational-databases/errors-events/mssqlserver-605-database-engine-error.md)
39-
[Table Hints (Transact-SQL)](~/t-sql/queries/hints-transact-sql-table.md)
40-
[SELECT (Transact-SQL)](~/t-sql/queries/select-transact-sql.md)
41-
[SET TRANSACTION ISOLATION LEVEL (Transact-SQL)](~/t-sql/statements/set-transaction-isolation-level-transact-sql.md)
42-
17+
18+
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
19+
20+
## Details
21+
22+
| Attribute | Value |
23+
| :--- | :--- |
24+
| Product Name | SQL Server |
25+
| Event ID | 601 |
26+
| Event Source | MSSQLSERVER |
27+
| Component | SQLEngine |
28+
| Symbolic Name | |
29+
| Message Text | Could not continue scan with NOLOCK due to data movement. |
30+
31+
## Explanation
32+
33+
The [!INCLUDE [ssDEnoversion](../../includes/ssdenoversion-md.md)] can't continue executing the query because it's trying to read data that was updated or deleted by another transaction. The query is using either the `NOLOCK` locking hint or the `READ UNCOMMITTED` transaction isolation level.
34+
35+
Typically, access to data that is being changed by another transaction is denied because of locks put on the data. However, the `NOLOCK` locking hint and `READ UNCOMMITTED` transaction isolation level let a query read data that is locked by another transaction. This scenario is referred to as a *dirty read*, because you can read values that aren't yet committed and that are subject to change.
36+
37+
## User action
38+
39+
This error cancels the query. Either resubmit the query or remove the `NOLOCK` locking hint.
40+
41+
## Related content
42+
43+
- [MSSQLSERVER_605](mssqlserver-605-database-engine-error.md)
44+
- [Table hints (Transact-SQL)](../../t-sql/queries/hints-transact-sql-table.md)
45+
- [SELECT (Transact-SQL)](../../t-sql/queries/select-transact-sql.md)
46+
- [SET TRANSACTION ISOLATION LEVEL (Transact-SQL)](../../t-sql/statements/set-transaction-isolation-level-transact-sql.md)

0 commit comments

Comments
 (0)