现在我正在使用SQL Server Management Studio 2005来pipe理我所有的SQL服务器(2000,2005,2008)。 我希望能够充分利用SSMS 2008中所有酷炫的新function,唯一让我失望的是新的基于DMV的活动监视器:
那么是否有人为SSMS 2008制作了一个插件来模拟旧的活动监视器? 如果不是的话,那么一套完整的或者更好的脚本,并且在2000 – 2008年间工作(不仅仅是sp_who2)呢?
检查出内置的(但未logging我认为?)存储过程sp_MSset_current_activity和sp_MSget_current_activity 。 他们应该得到所有你正在寻找的信息 – 只是不如活动监视器漂亮。
用法示例:
declare @id int exec dbo.sp_MSset_current_activity @id output exec dbo.sp_MSget_current_activity @id, @option = 1 exec dbo.sp_MSget_current_activity @id, @option = 2 exec dbo.sp_MSget_current_activity @id, @option = 3 exec dbo.sp_MSget_current_activity @id, @option = 4, @spid = 51 -- locks per spid exec dbo.sp_MSget_current_activity @id, @option = 5, @obj = N'sysobjects'
get程序在其中有注释,其中概述了不同的可用选项。