Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Attribute | Value |
---|---|
Product Name | SQL Server |
Event ID | 1205 |
Event Source | MSSQLSERVER |
Component | SQLEngine |
Symbolic Name | LK_VICTIM |
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. |
Resources are accessed in conflicting order on separate transactions, causing a deadlock. For example:
Transaction1
updates Table1.Row1
, while Transaction2 updates Table2.Row2
Transaction1
tries to update Table2.Row2
but is blocked because Transaction2
hasn't yet committed and hasn't released its locksTable1.Row1
but is blocked because Transaction1
hasn't committed and hasn't released its locksTransaction1
is waiting for Transaction2
to complete, but Transaction2
is waiting for Transaction1
to complete.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.
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.
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.
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.
For more information, see Handling Deadlocks and Minimizing Deadlocks.
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today