Blog
Projects
About
Backtrack:
Blog
›
Show long running processes/qu…
›
Comments
Comments
Show long running processes/queries on SQL Server
posted on September 3rd 2015, at 11:05
by
lunarg
Run the following T-SQL statements.
Show a list of longest running SPIDs on a SQL Server:
select P.spid, right(convert(varchar, dateadd(ms, datediff(ms, P.last_batch, getdate()), '1900-01-01'), 121), 12) as 'batch_duration', P.program_name, P.hostname, P.loginamefrom master.dbo.sysprocesses Pwhere P.spid > 50and P.status not in ('background', 'sleeping')and P.cmd not in ('AWAITING COMMAND' ,'MIRROR HANDLER' ,'LAZY WRITER' ,'CHECKPOINT SLEEP' ,'RA MANAGER')order by batch_duration desc
To retrieve the SQL for a specific SPID:
declare @spid int, @stmt_start int, @s
...
read more
Add a new comment
Your name:
Your e-mail:
Your comment:
Basic BBcode is supported.
Captcha:
Type the letters and numbers as shown.
Not readable?
Get another
.
Tags
computer
windows
software
vmware
microsoft
linux
exchange
hardware
network
news
mac
powershell
home
office365
msoffice
ad
sqlserver
server
dell
soaring
mssql
internet
esx
rds
sbs
events
powercli
terminalserver
virtualization
antivirus
Archive
«
‹
December 2024
›
»
Sun
Mon
Tue
Wed
Thu
Fri
Sat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Links
-
@harkx
-
Cats & Dogs
-
Jargon-free Security Guide
Quote
«
You only find out who is swimming naked when the tide goes out.
»
Warren Buffett
Contact
© 2009-2024 Black Manticore – all rights reserved
code by
lunarg
, design by
SuriAmanah
, hosted at Cats&Dogs