Skip to content

Determining the last time your SQL Server instance was restarted

Sql Server Tips

The following query will show the last time your SQL Server instance was started. I used this just today for planning purposes for doing SQL Server updates on a server that I had not ever restarted. I wanted to get an idea of how long it had been running before doing any work.

<!-- wp:paragraph -->
<p>SELECT sqlserver_start_time</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>FROM sys.dm_os_sys_info;</p>
<!-- /wp:paragraph -->

This sample has been tested on SQL Server 2008 through SQL Server 2019. I did confirm that it does not work on SQL Server 2005, but that is not too much of a surprise. Here are some samples of what the output looks like.

 

More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *