Article ID: 295108 - Last Review: December 23, 2005 - Revision: 3.5 Incomplete transaction may hold large number of locks and cause blockingThis article was previously published under Q295108 On This PageSUMMARY When a transaction is not completed either because a query
times out or because the batch is cancelled in the middle of a transaction
without issuing a COMMIT or ROLLBACK statement to complete the transaction, the
transaction is left open and all the locks acquired during that transaction
continue to be held. Subsequent transactions executed under the same connection
are treated as nested transactions, so all the locks acquired in these
completed transactions are not released. This problem repeats with all the
transactions executed from the same connection until a ROLLBACK is executed. As
a result, a large number of locks are held, users are blocked, and transactions
are lost, which results in data that is different from what you expect.
MORE INFORMATION The following example illustrates how locks are not
released as a result of an unfinished open transaction:
To avoid this kind of problem, check after each transaction to see if the transaction is complete by using the following statement: REFERENCESFor a description of how to monitor blocking with SQL scripts in SQL Server 7.0 or SQL Server 2000, see the following articles in the Microsoft Knowledge Base:251004
(http://support.microsoft.com/kb/251004/
)
How to monitor SQL Server 7.0 blocking
271509
(http://support.microsoft.com/kb/271509/
)
How to monitor blocking in SQL Server 2005 and in SQL Server 2000
APPLIES TO
| Article Translations
|
Back to the top
