SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

viperbyte
Posting Yak Master

USA
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?

viperbyte
Posting Yak Master

USA
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

robvolk
Most Valuable Yak

USA
15663 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

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2046 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
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000