Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Can't KILL a process Expand / Collapse
Author
Message
Posted Wednesday, August 15, 2012 8:16 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:26 PM
Points: 5,791, Visits: 10,140
I have a process that is blocking a lot of stuff on the server. The session id is "-2", which means that it's an orphaned distributed transaction (see KILL), so I look up the UnitOfWork with this code:
select distinct 'KILL ''' + convert(varchar(50), request_owner_guid) + ''';'
from sys.dm_tran_locks
where request_session_id = -24



and... when I run this KILL command, I get this error message:
Msg 6112, Level 16, State 1, Line 1
Distributed transaction with UOW {A31C3D99-E956-45F1-AA98-891509B9A11F} is in prepared state. Only Microsoft Distributed Transaction Coordinator can resolve this transaction. KILL command failed.


My google attempts are only pulling up the error message and translations for it. Any idea of how to handle this?

I don't know if this following information is helpful, but in case it is:
SQL 2008 R2 (build 10.50.1600) 64 bit cluster. Used in log shipping.


Thanks!


Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #1345288
Posted Wednesday, August 15, 2012 8:20 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, May 24, 2016 4:02 AM
Points: 5,968, Visits: 6,054
Trace the UOW back to the originiating host via sys.dm_exec_requests and terminate the DTC transaction from the source, that should resolve the issue.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1345295
Posted Wednesday, August 15, 2012 8:33 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:26 PM
Points: 5,791, Visits: 10,140
All that shows up in sys.dm_exec_requests are the transactions being blocked by session id "-2".

And then, just seconds later, it has cleared.

Okay, any ideas of what caused it to clear?


Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #1345302
Posted Wednesday, August 15, 2012 9:35 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:26 PM
Points: 5,791, Visits: 10,140
Update: the distributed transaction had to be killed (aborted) in the DTC snapin.

Edit: Link for tracking this down and doing this[/u]


Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #1345355
Posted Thursday, August 16, 2012 1:38 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, May 24, 2016 4:02 AM
Points: 5,968, Visits: 6,054
Good blog Wayne will bookmark that.

Just one thing you have a [/u] IFCode in the URL link, so if you click it you get a 404 error.




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1345702
Posted Thursday, August 16, 2012 6:41 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 8:45 AM
Points: 994, Visits: 3,609
WayneS (8/15/2012)
Update: the distributed transaction had to be killed (aborted) in the DTC snapin.

Edit: Link for tracking this down and doing this[/u]

Wayne, I think you need to remove the "\[u]" from your URL or it 404's.

I loved this line from the blog post you created to document this:
And now all is well with the world. Or is it?… do you know what you just did? Do you? DO YOU?


Rich
Post #1345900
Posted Thursday, August 16, 2012 7:19 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, July 29, 2015 7:46 AM
Points: 33, Visits: 300
1) Use this query to get the UOW (a GUID) of the offending transaction:

use master
select distinct req_transactionUOW from syslockinfo

Note: Ignore the UOW records that are all zeros. “00000000-0000-0000-0000-000000000000”

2) Use the Kill command, replacing the GUID below with the req_transactionUOW obtained from the query above, to kill the offending transaction:

KILL ‘D5499C66-E398-45CA-BF7E-DC9C194B48CF’

Repeat for each orphaned transaction.



Post #1345938
Posted Friday, October 2, 2015 2:06 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 2:54 PM
Points: 441, Visits: 2,491
I'm late to the party as usual, but just hit this issue for the first time. We handle -2 blocking with a process that alerts us when it happens and generates the KILL 'UOW' line... but this must be the first "prepare state" condition we've hit...

Trace the UOW back to the originiating host via sys.dm_exec_requests and terminate the DTC transaction from the source, that should resolve the issue.


Can you elaborate on this a bit? The "normal" KILL 'UOW' fails and prompts to use the COMMIT/ABORT syntax. ABORT gets another error and COMMIT appeared to work but the UOW was still there.

I'm trying to figure out what row(s) in sys.dm_exec_requests are related to the -2 rows in syslockinfo but I'm not seeing it; transaction_id is CLOSE to req_trasactionID but doesn't match...

Once I have the right row(s)... what breadcrumbs do I follow to find the source of the bad transaction?

Thanks in advance for your time


EDIT: uhhh... oops... "nevermind"
... I'd already scanned through the other posts... I tried Wayne's link but due to the "//[u" at the END of the link-- it sent me instead to his piece about understanding-rebinds-and-rewinds... yikes... THEN I noticed the URL didn't LOOK like that's where it was s'posed to go...ooooOOOOooooo

But I am still kinda curious how I could'a used sys.dm_exec_requests to get to the source.



Cursors are useful if you don't know SQL
Post #1725091
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse