使用sp_who获得特定处理或过程的信息

来源:互联网 发布:win8电脑优化 编辑:程序博客网 时间:2024/06/08 01:21
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

一个用户数据处理或过程有时候会对SQL Server2000有着负面影响。例如,当用户建立一个高级的数据操作时,它可以产生数据操作的劲瓶,只有等到这一操作完成之后,其他用户的操作才可以进行。也许你没有听到开发人员的抱怨,但你应该听到过等候的用户的抱怨。这就是无法获得特定处理和过程的信息的原因。

当你要查找减缓用户操作原因的信息时,sp_who是一款最为方便的工具。她是一种系统存储的程序,可以提供用户和过程的当前信息。除此之外,可以使用它来获得正在处理过程的信息,包括空闲的过程。

sp_who的操作结果提供一些很有用的纵栏,包括:spid(系统过程ID),ecid(与spid相关的给定线程的环境ID),过程状态,loginame, hostname, blk(模块过程的系统ID),数据库名称,以及SQL Server执行过程的命令。

以下的范例是使用sp_who来列举当前正在运行的过程:

USE master
EXEC sp_who

如果你想查找一个特定用户过程,可以使用他或她的注册,如下所示:

USE master
EXEC sp_who 'jharvey'

其他选择,包括获得当前运行过程或者特定过程的所有信息,可以仿制如下范例操作:

USE master
EXEC sp_who 'active'

USE master
EXEC sp_who '10'&nbsp; -- 10 is the specific process id

&nbsp;<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击