SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Can't KILL a process


Can't KILL a process

Author
Message
WayneS
WayneS
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21640 Visits: 10652
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

anthony.green
anthony.green
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24410 Visits: 6519
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


WayneS
WayneS
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21640 Visits: 10652
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

WayneS
WayneS
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21640 Visits: 10652
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

anthony.green
anthony.green
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24410 Visits: 6519
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


Rich Mechaber
Rich Mechaber
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2757 Visits: 3671
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
mxhxr
mxhxr
SSC-Enthusiastic
SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)SSC-Enthusiastic (135 reputation)

Group: General Forum Members
Points: 135 Visits: 304
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.



mstjean
mstjean
SSC Eights!
SSC Eights! (933 reputation)SSC Eights! (933 reputation)SSC Eights! (933 reputation)SSC Eights! (933 reputation)SSC Eights! (933 reputation)SSC Eights! (933 reputation)SSC Eights! (933 reputation)SSC Eights! (933 reputation)

Group: General Forum Members
Points: 933 Visits: 2550
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" Pinch
... 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 Whistling

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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search