DBA - How To Find When SQL Server Instance was Started Last Time

We often want to know what was the last time SQL Server instance restarted. There are multiple ways to find out. Here is TSQL script that can be used to find out the restart time of SQL Server instance.

SELECT sqlserver_start_time FROM sys.dm_os_sys_info

By using GUI:
Whenever the SQL Server Instance restart, It recreates the Tempdb. We can go to the properties of TempDB and check the time it was created. That is the same time when SQL Server Instance restarted.

Fig 1: Properties of TempDB

Fig 2: Get the Last Restart Time of SQL Server Instance by using TempDB Create Time.

If you don't want to use the GUI, You can use below query to get the restart time of SQL Server instance. By using below query you are getting the create date for Tempdb that is same when the SQL Server Instance was restarted.

Select create_date as RestartTime from sys.databases
where name='tempdb'

No comments:

Post a Comment