Database-based Transaction Counting Find Script

, 2018-06-08 (first published: )

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)

Share

Share

Rate

3 (4)

Related content

Basics of C2 Auditing

Auditing in SQL Server is something that is becoming more and more prevelant, and will likely become more regulated over time. Dinesh Asanka brings us a new article on the basics of SQL Servers most powerful auditing configuration, C2 level auditing.

4.88 (8)

2004-11-03

28,578 reads

Monitoring Drive and Database Free Space

SQL Server will autogrow your databases as they run out of space. But the process doesn't manage space, nor does it check the free space on the drive. Allowing autogrow to grow unchecked and unmanaged will eventually use up all the free disk space and potentially crash your server. New author Mark Nash brings you his system for monitoring space usage and generating a report that eases this process.

4.4 (5)

2006-08-25 (first published: )

43,136 reads