/* SQL Server transactions
per day/hour/minute using sys.dm_os_performance_counters */
-- declarations
DECLARE
@Days
SMALLINT,
@Hours
INT,
@Minutes
BIGINT,
@LastRestart
DATETIME;
-- get last restart date
SELECT
@Days
= DATEDIFF(D, create_date, GETDATE()),@LastRestart = create_date
FROM
sys.databases
WHERE
database_id
= 2;
-- collect days/hours since
last restart
SELECT @Days = CASE WHEN @Days = 0 THEN 1 ELSE @Days END;
SELECT @Hours = @Days * 24;
SELECT @Minutes = @Hours * 60;
-- trans since last restart
SELECT
@LastRestart
[LastRestart],
@@servername [Instance],
cntr_value
[TotalTransSinceLastRestart],
cntr_value
/ @Days [AvgTransPerDay],
cntr_value
/ @Hours [AvgTransPerHour],
cntr_value
/ @Minutes [AvgTransPerMinute]
FROM
sys.dm_os_performance_counters
WHERE
counter_name
= 'Transactions/sec'
AND instance_name = '_Total';
-- trans since last restart
per database
SELECT
@LastRestart
[LastRestart],
@@servername [Instance],
instance_name
[Database_Name],
cntr_value
[TotalTransSinceLastRestart],
cntr_value
/ @Days [AvgTransPerDay],
cntr_value
/ @Hours [AvgTransPerHour],
cntr_value
/ @Minutes [AvgTransPerMinute]
FROM
sys.dm_os_performance_counters
WHERE
counter_name
= 'Transactions/sec'
AND instance_name <> '_Total'
ORDER BY
cntr_value DESC;
Your output will be similar to this:
Take a look at this for more details on the dm_os_performance_counters DMV: sys.dm_os_performance_counters
Nice content, It is definitely very helpful for my professional workers. I having many kinds of knowledge from your blog...
ReplyDeleteOracle Training in Chennai
Oracle Training institute in chennai
Excel Training in Chennai
Corporate Training in Chennai
Embedded System Course Chennai
Tableau Training in Chennai
Linux Training in Chennai
Oracle Training in Chennai
Oracle Training institute in chennai
You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things
ReplyDeleteSEO Training in Chennai
SEO Course in Chennai
Cloud Computing Training in Chennai
Data Science Course in Chennai
Devops Training in Chennai
Digital Marketing Course in Chennai
Selenium Training in Chennai
SEO Training in Tnagar
Thank you both for reading. I'm glad to have helped!
ReplyDelete
ReplyDeleteGreat post. keep sharing such a worthy information
Selenium Training in Chennai
Selenium Training in Bangalore
Selenium Training in Coimbatore
Selenium course in Chennai
Selenium Course in Bangalore
Selenium Course in Coimbatore
Software Testing Course in Chennai
Hacking Course in Bangalore
Thank you! I am very glad to have helped.
ReplyDeleteI have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. שרת וירטואלי
ReplyDeletevery interesting post.this is my first time visit here.i found so mmany interesting stuff in your blog especially its discussion..thanks for the post! mélybölcsős szállítás Europa-Road Kft
ReplyDeleteAmazing Post. keep update more information.
ReplyDeleteWeb Designing Course in chennai
web Designing Training in Chennai
Web Designing Course Online
Really wonderful blog! Thanks for taking your valuable time to share this with us. Keep us updated with more such blogs.
ReplyDeleteAWS Course in Chennai
AWS Online Course
AWS Course in Coimbatore
Great post. It is really helpful for me.keep sharing such a worthy information..
ReplyDeleteWeb Development courses in Chennai
I was basically inspecting through the web filtering for certain data and ran over your blog. I am flabbergasted by the data that you have on this blog. It shows how well you welcome this subject. Bookmarked this page, will return for extra. data science course in jaipur
ReplyDeleteExtremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing. python course in delhi
ReplyDeleteNice blog to read. Thanks.
ReplyDeleteFull Stack Developer Online Training
Full Stack Online Course
Amazingly by and large very interesting post. I was looking for such an information and thoroughly enjoyed examining this one.
ReplyDeleteKeep posting. An obligation of appreciation is all together for sharing.
business analytics course in gwalior
Hi there, You have done a fantastic job. I’ll certainly digg it and personally suggest to my friends. I am sure they will be benefited from this site.|data science course in jodhpur
ReplyDeleteGood content. You write beautiful things.
ReplyDeletevbet
taksi
sportsbet
mrbahis
korsan taksi
sportsbet
mrbahis
hacklink
hacklink
if i need it for a full month?
ReplyDeleteThough I knew a bit of data science already, this post has been so enlightening for me, as I got to understand some of the latest trends in this field through this. I had seen many data science and analytics-based courses online when I was looking for a course for my friend; however, this post guided me in the right direction, and I was able to help my friend with the right suggestion, thanks to this informative post.
ReplyDeletebest training institute for data analytics in pune
Though I knew a bit of data science already, this post has been so enlightening for me, as I got to understand some of the latest trends in this field through this. I had seen many data science and analytics-based courses online when I was looking for a course for my friend; however, this post guided me in the right direction, and I was able to help my friend with the right suggestion, thanks to this informative post.
ReplyDeletebest training institute for data analytics in pune
excellent post. Keep up the good work.
ReplyDeleteSQL Course in Pune
Its really helpful. Thanks for such an amazing article.
ReplyDeleteExcellent blog! Appreciate you sharing such a wonderful piece of content. Please continue to share valuable information aligning with my interests.
ReplyDeletebest software training institute in chennai
Thank you all for the great comments! I am glad to so many readers!
ReplyDelete