devxlogo

Monitor stored procedure and batch activity from remote workstations

Monitor stored procedure and batch activity from remote workstations

Using the sp_user_counterX stored procedure (where X is a number between 1 and 10) you can set internal SQL Server counters. This values are read by the Performance Monitor, the standard Windows utility that monitors system activity. The Performance Monitor is able to monitor not only the activities like these, but also other useful information for correctly measuring the database engine activity, through the counters labeled as “SQL Server: User Settable” and their instances (“User counter 1-10”). Thus the PM will display in real time these values, on the same or a remote machine. For example, the following T-SQL statements load the register #5 of user counters with the number of processes that are currently active:

declare @valore as integerset @valore = (select count(*) from sysprocesses)exec sp_user_counter1 @valore

########################################################

This tip has been originally published on Microsoft Italia’s web site.
It has been translated and re-published on VB2TheMax with the permission of Microsoft Italia.
You can find more tips like this one (in Italian) at http://www.microsoft.com/italy/sql/articoli

########################################################

See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist