sql server 死锁自动释放

Posted 翱翔的小鱼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql server 死锁自动释放相关的知识,希望对你有一定的参考价值。

在高并发时数据库发生会死锁,发生死锁后,数据库会自动释放

 

 

原文:

When a transaction is chosen as a deadlock victim, SQL Server will rollback the victim\'s transaction which releases locks held by the transaction. This will allow other transactions to proceed.

Unlike blocking, deadlocks do no persist for long periods. If a query times out or an impatient user cancels a blocked query during execution (attention event), no further T-SQL code on the connection is executed, including the CATCH block. The transaction will remain open (with locks held) unless the XACT_ABORT session setting is set. For this reason, I suggest you specify SET XACT_ABORT ON in stored procedures with explicit transactions. See http://weblogs.sqlteam.com/dang/archive/2007/10/20/Use-Caution-with-Explicit-Transactions-in-Stored-Procedures.aspx.

Note that long-term blocking can sometimes lead to deadlocks. To improve concurrency, I suggest you review your query execution plans for query and index tuning opportunies. This will help ensure that only the data actually needed is touched and locked.

以上是关于sql server 死锁自动释放的主要内容,如果未能解决你的问题,请参考以下文章

SQL Server死锁产生原因及解决办法

追踪SQL Server执行delete操作时候锁的申请与释放过程

SQL Server死锁排查经历 -基于SqlProfiler

在sql server 2000中进行内存的自动释放怎么实现?拜托各位了 3Q

SQL server2008 临时表tempdb如何自动释放存储空间

减少SQL Server数据库死锁的技巧