有没有人知道如何测量SQL Server 2008中特定数据库的每秒SQL事务数?
答案 0 :(得分:12)
DECLARE @cntr_value bigint
SELECT @cntr_value = cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name = 'transactions/sec'
AND object_name = 'SQLServer:Databases'
AND instance_name = 'YourDatabase'
WAITFOR DELAY '00:00:01'
SELECT cntr_value - @cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name = 'transactions/sec'
AND object_name = 'SQLServer:Databases'
AND instance_name = 'YourDatabase'
答案 1 :(得分:0)
位于https://www.brentozar.com/askbrent/的sp_BlitzFirst过程会在数据库级别返回此信息,以及许多其他重要信息。如下所示的简单调用将向您显示在5秒内发生的事情。
EXEC dbo.sp_BlitzFirst @ExpertMode = 1, @seconds = 5;