Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

With the following query I can find processes on the dataserver

select *,db_name(rsc_dbid) as db_name from sys.syslockinfo (nolock)

Can I derive the SQL query from processes that are blocked?

Specifically, we get orphaned, blocking processes (with a req_spid of -2) but we don't know why.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Have a look at sp_WhoIsActive from Adam Machanic. It tells you what's running, what's blocking, and it derives the SQL text from those queries.

share|improve this answer
1  
That, sir, is awesome. –  Synesso Apr 25 '12 at 23:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.