“僵局受害者”在交易中,如何改变优先级?
我记录了 ASP.NET 应用程序引发的异常。
消息:事务(进程 ID 56) 锁上陷入僵局|沟通 与另一个进程缓冲资源 并被选为僵局 受害者。重新运行事务。
我确信其原因是,我直接在 SSMS 中对同时在应用程序中查询的表运行一些select
。
所以现在我的问题是:
- 我可以更改 SQL Server 选择“死锁受害者”的优先级吗?我想选择“我自己”(SSMS) 作为死锁受害者,而不是 ASP.NET,因为它是一个时间关键的应用程序,对我来说重新运行手动查询比让用户接受错误更容易。
先感谢您。
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.
SET DEADLOCK_PRIORITY 允许您微调优先级
您可以在 SSMS 会话(每个查询窗口)或全局中指定:
SET DEADLOCK_PRIORITY allows you to fine tune the precedence
You can specify this in your SSMS session (per query window) or globally: