回到目录 在SQLSERVER中每个会话,即每个查询分析器窗口都会产生一个SQL进程,对于那些持续时间短的进程,它们转瞬即失,而对于持续时间比较长的,我们需要希望查看它的运行状态,就可以借助SQL提供的sp_who命令,下面是对它的具体介绍,主要选自MSDN. sp_wh
回到目录
在SQLSERVER中每个会话,即每个查询分析器窗口都会产生一个SQL进程,对于那些持续时间短的进程,它们转瞬即失,而对于持续时间比较长的,我们需要希望查看它的运行状态,就可以借助SQL提供的sp_who命令,下面是对它的具体介绍,主要选自MSDN.
<strong>sp_who</strong> [ [ <strong>@loginame = </strong>] <strong>'</strong><span>login</span><strong>' | </strong><span>session ID</span><strong> | 'ACTIVE' </strong>]<br>你可以在sp_who后面加你的SPID号(sessionID),登陆名,线程状态等<br><br><img src="/inc/test.jsp?url=http%3A%2F%2Fwww.cnblogs.com%2Flori%2Fp%2Fdata%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAkoAAACnCAIAAABhBOS7AAAgAElEQVR4nO1du24kObLNr1msI0F2WmMssLYAyV5nUL4GEIT1%2Bg9UAwho7CdcoLHGFZDfMLhWG%2B3Vx9Q18sEg48FHMjMjVDxIDHqyyGAwGMHDYJXI7tfPv759%2B%2FZbQ0NDQ0PDF0K30Nt1M2wqfM9W9unIPrDVF1vaKkR1A7YRqQiLxjShs0dvv37%2BVf2B3LmF%2FN1a2acj%2Bzy2%2BmJLW4VPdQO2Ean4WDSmFZ0bvSlqYrfHVl9saavwafSm%2BbFoTCs6N3pT1MRuj62%2B2NJW4dPoTfNj0ZhWdLZDb58vD%2Fcvww7mZhqyMqLlgyJauGlr90k14PgmwbDxWEgW1Z4d5i7VOm%2F0fL483L9opTcu9qqbO7mhpCYEJTWF%2BlrC2Lcv1ehN0xDs%2BTR60%2Fw0eqvQO8aZtdJb5shpyd5uhN6Maqu1g1oM2OhNz%2BiUPTdLb0zhw%2BhteL3ruq7ruofXH78%2BXx7uH5%2FvxxeP32FPPl8euhkF9Oaq3719ji%2Ff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YPXNBO%2BBr01JKK6AbcdkWN3tXaHRffWr%2FP%2FAz6hUhNIRLh%2FAAAAAElFTkSuQmCC&refer=http%3A%2F%2Fwww.cnblogs.com%2Flori%2Fp%2F3303550.html" alt="知方可补不足~sqlserver中使用sp" ><br>
下面对status执行状态作一个简单的说明,选自MSDN
background:会话正在运行一个后台任务,例如死锁检测。
rollback: 会话具有正在处理的事务回滚。
pending: 会话正在等待工作线程变为可用。
runnable: 会话的任务在等待获取时间量程时位于计划程序的可运行队列中。
spinloop: 会话的任务正在等待调节锁变为可用。
suspended: 会话正在等待事件(如 I/O)完成。
注意:如果你的代码处理数据比较大,SQL会创建子线程进行并行处理,子线程的标示为ecid。
别外,如果希望查看SQL进程的详细信息,可以使用下面代码
SELECT * FROM sys.sysprocesses
查看被锁住的对象,可以使用下面代码
SELECT * FROM sys.syslockinfo
如果希望查看指定会话(SQL进程)的语句(从客户端发过来的SQL语句),可以使用下面语句
dbcc inputbuffer(Session_ID)
如果希望查看正在被阻塞的语句(sysprocesses的blocked),可以使用下面语句
dbcc inputbuffer(Blocked)
回到目录