/* 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
Great experience for me by reading this blog. Thank you for wonderful article.
ReplyDeleteAngularjs Training in Chennai
Angularjs Training in Bangalore
angularjs training institute in bangalore
Angular Training in hyderabad
best angularjs training in bangalore
Angular course in hyderabad
Salesforce Training in Bangalore
Hadoop training in bangalore
This Blog is really informative!! keep update more about this...
ReplyDeleteAviation Academy in Chennai
Air Hostess Training in Chennai
Airport Management Courses in Chennai
Best Aviation Academy in Chennai
Ground Staff Training in Chennai
Air Hostess Academy in Chennai
Airport Management Training in Chennai
Airport Ground Staff Training Courses in Chennai
very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
ReplyDeleteWeb Designing Course Training in Chennai | Web Designing Course Training in annanagar | Web Designing Course Training in omr | Web Designing Course Training in porur | Web Designing Course Training in tambaram | Web Designing Course Training in velachery
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple linear regression
data science interview questions
I am looking for and I love to post a comment that "The content of your post is awesome" Great work!
ReplyDeleteSimple Linear Regression
Correlation vs Covariance
very well explained .I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteSimple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained
Thank you! I am very glad to have helped.
Deletevery well explained .I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteSimple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained
I 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
Truly mind blowing blog went amazed with the subject they have developed the content. These kind of posts really helpful to gain the knowledge of unknown things which surely triggers to motivate and learn the new innovative contents. Hope you deliver the similar successive contents forthcoming as well.
ReplyDeletedata science certification in bhilai