Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Hung spid question.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

132 Posts

Posted - 12/14/2012 :  13:25:16  Show Profile  Reply with Quote
Hello everyone, second week and still here, whew.
What's the effect, damage if any on having a couple of SPIDs hanging around? When I run this script:

SELECT LTRIM (st.[text]) AS [Command Text],[host_name], der.session_id AS [SPID],
der.[status], db_name(database_id) AS [Database Name],
ISNULL(der.wait_type, 'None') AS [Wait Type],
der.logical_reads, der.cpu_time, der.total_elapsed_time
FROM sys.dm_exec_requests AS der
INNER JOIN sys.dm_exec_connections AS dexc
ON der.session_id = dexc.session_id
INNER JOIN sys.dm_exec_sessions AS dexs
ON dexs.session_id = der.session_id
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS st
WHERE der.session_id >= 51
AND der.session_id <> @@spid -- eliminate this connection
ORDER BY der.[status]

I get these two rows of output:
Command Text host_name SPID status Database Name Wait Type logical_reads cpu_time total_elapsed_time
create procedure [sys].[sp_cdc_scan] xxxxx 52 suspended myDB WAITFOR 587108 22479 208296248
create procedure[sys].[sp_cdc_scan] xxxxx 53 suspended Document Management WAITFOR 704333 49655 208296247

Am I supposed to do something about this?

Posting Yak Master

132 Posts

Posted - 12/14/2012 :  13:27:08  Show Profile  Reply with Quote
I just read my post and see how tough it is to read the output. 52 and 53 are from the SPID column.
Go to Top of Page

Most Valuable Yak

15732 Posts

Posted - 12/14/2012 :  14:00:24  Show Profile  Visit robvolk's Homepage  Reply with Quote
They look like they're running Change Data Capture procedures. I don't recommend killing them until you can investigate (check CDC config, is it running? should it be running? etc.) If you don't need CDC then it's better to simply turn it off rather than killing its SPIDs.
Go to Top of Page

Flowing Fount of Yak Knowledge

United Kingdom
2179 Posts

Posted - 12/15/2012 :  12:11:17  Show Profile  Visit jackv's Homepage  Reply with Quote
It is also useful to include the "blocking_session_id" column from the sys.dm_exec_requests - gives a quick guide on whether the request is being blocked

Jack Vamvas
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000