Showing posts with label pid. Show all posts
Showing posts with label pid. Show all posts

Sunday, February 19, 2012

Complete Command of given PID

Hi,
we sometimes have statements which seem to block the whole server.
now i use this to get information of running processes:
SELECT
spid,
kpid,
status,
hostname
, USER_NAME(uid)
, program_name
, DB_NAME(dbid)
, memusage,*
FROM
master.dbo.sysprocesses
WHERE
status = 'runnable'
ORDER BY
status
aSC
the cmd row only shows the single first row of the statement,
so i cant get the information where the statement really comes from.
is there a way to get it all? maybe the whole statment or
sp_ text which is running inside this pid?
thanks,
peppiAs an alternative, have you considered using the SQL Profiler?|||Yes,-)
sometimes bad processes are running on 100% cpu and i cant even start
enterprise manager. only thing i can get running is queryanalyzer, so
i need some handy stuff to get information to kill some tasks and
see where it came from first.
i found fn_get_sql migt be useful,
maybe someone has got a procedure which gets all running tasks and
shows the text in one procedure?
thanks,
mike|||This may help
http://www.sommarskog.se/sqlutil/aba_lockinfo.html|||If you have PID with you,
run =>
DBCC INPUTBUFFER(PID),
to get the query rather than getting it from sysprocess...
If you have to monitor more and need to get the full query use Profiler.
Thanks,
Sree
"markc600@.hotmail.com" wrote:

> As an alternative, have you considered using the SQL Profiler?
>