Force a transaction from another connection?

It is very difficult for us to identify an error in one of our software solutions, which sometimes leave an open transaction. We have this application in production on several sites (read: 70+), and we have seen this problem twice this year in different places.

The problem we are facing is a transaction that remains open from a permanent connection to SQL Server. Using dbcc opentran shows that one transaction remains open. In today's case, it was open from 9:30, before we realized it at 13:00. Closing a program using a connection will close / cancel the transaction, and all data in the morning is still lost.

Using dbcc opentran , he replies that the name of the open transaction was user_transaction . Attempting to close it using commit tran user_transaction gives the error The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. .

I understand that you almost never want to force a transaction without prior knowledge of the connection, but is there a way to do this? In this case, we closed the program, and we lost commercial value in a day.

Thanks.

+4
source share
1 answer

If a transaction could be committed by other consensus, then this is not a transaction. If it were possible, it would open the way to more problems than it would solve.

See this link: http://ask.sqlservercentral.com/questions/3865/forcing-a-transaction-to-commit.html

+7
source

Source: https://habr.com/ru/post/1487134/


All Articles