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/errors-events/mssqlserver-1205-database-engine-error.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,46 +3,46 @@ title: "MSSQLSERVER_1205"
3
3
description: "MSSQLSERVER_1205"
4
4
author: MashaMSFT
5
5
ms.author: mathoma
6
-
ms.date: "04/04/2017"
6
+
ms.reviewer: randolphwest
7
+
ms.date: 12/16/2024
7
8
ms.service: sql
8
9
ms.subservice: supportability
9
10
ms.topic: "reference"
10
11
helpviewer_keywords:
11
12
- "1205 (Database Engine error)"
12
13
---
13
14
# MSSQLSERVER_1205
15
+
14
16
[!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
+
27
29
## Explanation
28
30
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).
37
39
40
+
## User action
38
41
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).
39
43
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.
41
45
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.
43
47
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
-
48
48
For more information, see [Handling Deadlocks](../sql-server-deadlocks-guide.md?#handle-deadlocks) and [Minimizing Deadlocks](../sql-server-deadlocks-guide.md#minimize-deadlocks).
|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.
| 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.
0 commit comments