While doing some performance testing recently and utilizing some of the DMV’s I figured, I better find out when the SQL Server Service was restarted. The reason being, the DMV’s get cleared out when SQL Server is restarted! Otherwise, the server I was doing performance testing on could have been restarted so recently, that the data stored so far may not provide a true representation of the performance of the server. To that end, I had to find out when the TEMPDB was created (which also occurs on restart). The easiest way for me to find that out was to write the below script.
Script: When was SQL Server Restarted?
create_date AS SQL_Last_Started
name = 'tempdb'
Not a difficult script by any means, but it could help in determining if you should even use the results of the DMV’s to make performance related decisions! There are other ways to determine when the server was restarted, but this was the quickest that I could think of off the top of my head.
I hope that you have enjoyed this post. If you did, please take just a moment to rate it below! Also, if you don’t already, please be sure to follow me on twitter at @briankmcdonald. Also note that you can subscribe to an RSS feed of my blogs.
Brian K. McDonald, MCDBA, MCSD
Business Intelligence Consultant – Pragmatic Works
Email: email@example.com | Blogs: SSRSGeek | SQLServerCentral | BIDN
Twitter: @briankmcdonald | LinkedIn: http://tinyurl.com/BrianKMcDonald