Sql Server 2000 - How can I find out what stored procedures are running currently?

前端 未结 5 851
青春惊慌失措
青春惊慌失措 2021-01-18 08:05

I\'d like to know what stored procedures are currently running to diagnose some performance problems. How can I find that out?

相关标签:
5条回答
  • 2021-01-18 08:38

    Very useful script for analyzing locks and deadlocks: http://www.sommarskog.se/sqlutil/aba_lockinfo.html

    It shows procedure or trigger and current statement.

    0 讨论(0)
  • 2021-01-18 08:45

    You can use SQL Profiler to find that out.

    EDIT: If you can stop the app you are running, you can start SQL Profiler, run the app and look at what's running including stored procedures.

    0 讨论(0)
  • 2021-01-18 08:49

    I think you can do execute sp_who2 to get the list of connections, but then you'll need to run a trace through SQL Profiler on the specific connection to see what it's executing. I don't think that works with queries that are already running though.

    0 讨论(0)
  • 2021-01-18 08:54

    Using Enterprise Manager, you can open the Management tree section, and choose Current Activity -> Process Info. Double clicking on a Process ID will show you what that process is running. If it's a stored procedure, it will not show you the parameters. For that it would be better to use Brian Kim's suggestion of using the SQL Profiler.

    0 讨论(0)
  • 2021-01-18 08:56

    DBCC INPUTBUFFER will show you the first 255 characters of input on a spid (you can use sp_who2 to determine the spids you're interested in). To see the whole command, you can use ::fn_get_sql().

    0 讨论(0)
提交回复
热议问题