简体   繁体   English

Sql Server 2000 - 如何找出当前正在运行的存储过程?

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

I'd like to know what stored procedures are currently running to diagnose some performance problems. 我想知道当前正在运行哪些存储过程来诊断一些性能问题。 How can I find that out? 我怎么能找到它?

Very useful script for analyzing locks and deadlocks: http://www.sommarskog.se/sqlutil/aba_lockinfo.html 用于分析锁和死锁的非常有用的脚本: http//www.sommarskog.se/sqlutil/aba_lockinfo.html

It shows procedure or trigger and current statement. 它显示过程或触发器和当前语句。

You can use SQL Profiler to find that out. 您可以使用SQL事件探查器找到它。

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. 编辑:如果您可以停止正在运行的应用程序,您可以启动SQL事件探查器,运行该应用程序并查看正在运行的应用程序,包括存储过程。

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. 我认为您可以执行sp_who2来获取连接列表,但是您需要在特定连接上通过SQL事件探查器运行跟踪以查看它正在执行的内容。 I don't think that works with queries that are already running though. 我认为这不适用于已经运行的查询。

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). DBCC INPUTBUFFER将显示spid上输入的前255个字符(您可以使用sp_who2来确定您感兴趣的spid)。 To see the whole command, you can use ::fn_get_sql() . 要查看整个命令,可以使用:: fn_get_sql()

Using Enterprise Manager, you can open the Management tree section, and choose Current Activity -> Process Info. 使用Enterprise Manager,您可以打开“管理树”部分,然后选择“当前活动” - >“流程信息”。 Double clicking on a Process ID will show you what that process is running. 双击进程ID将显示该进程正在运行的内容。 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. 为此,最好使用Brian Kim的使用SQL Profiler的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在SQL Server 2000中找到所有存储的过程和作业 - find the all the stored procedures and jobs in sql server 2000 审计对 SQL Server 2000 中存储过程的更改 - Audit changes to stored procedures in SQL Server 2000 如何查找自定义角色对哪些存储过程具有执行权限? SQL服务器 - How can I find what stored procedures does a custom role have execute permission on? SQL SEVER SQL Server:如何从数据库中的所有存储过程中找到特定值? - SQL Server : how can I find the specific value from all stored procedures in my database? 如何并行运行sql server存储过程? - How can I run sql server stored procedures in parallel? 存储过程:与SQL Server 2000更相似-Postgresql或MySQL - Stored Procedures: Which is more similar to SQL Server 2000 - Postgresql or MySQL SQL Server 2000中当前运行的SQL语句的执行计划 - Execution Plan for a Currently Running SQL Statement in SQL Server 2000 如何在SQL Server中查找存储过程执行时间? - How to find Stored Procedures execution time in SQL Server? 如何在SQL Server中查找使用“我的数据库”的存储过程 - How to find stored procedures which are using 'My Database' in SQL Server 如何在SQL Server 2012中查找作用于表的存储过程? - How to find the stored procedures acting on a table in SQL Server 2012?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM