“deadlock victim” in transaction, how to change the priority?

北城以北 提交于 2019-12-04 04:05:51

问题


i have logged an exception thrown by an ASP.NET-Application.

Message: Transaction (Process ID 56) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

I'm sure that the reason for it was, that i was running some selects directly in SSMS on tables that were queried in the application in the same time.

So now my question is:

  • Can i change the priority SQL-Server chooses "deadlock victims"? I would like to choose "myself" (SSMS) as deadlock victim and not ASP.NET, because it's a time-critical application and it's easier for me to rerun the manual query than for the users to accept an error.

Thank you in advance.


回答1:


SET DEADLOCK_PRIORITY allows you to fine tune the precedence

You can specify this in your SSMS session (per query window) or globally:



来源:https://stackoverflow.com/questions/6290114/deadlock-victim-in-transaction-how-to-change-the-priority

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!