Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill or rollback active transaction?

How can I kill or rollback, uncommitted transaction?

I am listing my active transactions with the following sql:

SELECT * FROM sys.dm_tran_session_transactions 

My result is:

session_id  transaction_id       transaction_descriptor enlist_count is_user_transaction is_local is_enlisted is_bound
----------------------------------------------------------------------------------------------------------------------
54          117260               0x0100000036000000     0            1                   1        0           0

I dont want to kill the session (54)...

Thanks all

like image 733
ogun Avatar asked Oct 20 '10 13:10

ogun


1 Answers

To clear all transaction, Use this only as a temp solution

ALTER DATABASE DatabaseName

SET SINGLE_USER

WITH ROLLBACK IMMEDIATE;

ALTER DATABASE DatabaseName

SET MULTI_USER;

refer this site for more info

Points to check - it also rollbacks committed transactions

like image 146
Arun Prasad E S Avatar answered Sep 24 '22 19:09

Arun Prasad E S