Technical Article

Database-based Transaction Counting Find Script

,

Within the last minute you can learn about our transaction volume on our database with our script below.

NOTE: You can monitor the number of transactions that occur within the range of 10 minutes, 2 minutes, etc., by entering the desired time interval into the WAITFOR DELAY statement.
This script can also be graphically monitored in charts via SSRS by being converted into Jobs in certain periods.
Yusuf KAHVECI
yusufkahveci@sqlturkiye.com
www.sqlturkiye.com
Thanks.
DECLARE @Start BIGINT
DECLARE @End BIGINT
SELECT
@Start = cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name = 'Transactions/sec'
AND instance_name = 'AdvantureWorks'; -- Database Name

WAITFOR DELAY '00:01:00'

SELECT
@End = cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name = 'Transactions/sec'
AND instance_name = 'AdvantureWorks'; -- Database Name
SELECT
(@End - @Start) 'Total Number of Transactions Received in 1 Minute'
GO

Rate

3 (4)

You rated this post out of 5. Change rating

Share

Share

Rate

3 (4)

You rated this post out of 5. Change rating