How to find last restart of Sql Server

Do you need to find the last restart time/date of your Sql Server, but only have access through Sql Server Management Studio?  Running the query below will tell you the last time the service has been restarted.

There is a view called “sys.dm_os_sys_info” which has this information (and a bunch of others) in a field called appropriately enough “sqlserver_start_time”.

To read more about this Dynamic Management View (DMV), please follow this link.

https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-os-sys-info-transact-sql

If we run the following query, we can see that my Sql Server service was last restarted on 2017-06-24 09:48:15.350.

Select sqlserver_start_time from sys.dm_os_sys_info

 

rb1

 

Next we restart the service.

rb3

 

Then we rerun the query and see that the time has changed.

rb4

 

There are other ways to find out this information if you have access to the server either physically or through RDP.  You can read the Sql Server Error log or look through the Windows Event viewer.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s