You can use below methods to check the last time a SQL Server instance was started.
Option 1 : Search the SQL Server error log for process start time.
--search the current sql server error log for the the startup process id
DECLARE @ProcessType VARCHAR(64) = 'Server'
DECLARE @TextSearch VARCHAR(20) = 'Server process ID is'
DECLARE @LogType TINYINT = 1 -- 1 = SQL 2 = Agent
DECLARE @LogNum TINYINT = 0 -- 0 = current 1 =.1 etc
DECLARE @ErrLog AS TABLE([LogDate] DATETIME, [ProcessInfo] VARCHAR(64), [TEXT] VARCHAR(MAX))
INSERT INTO @ErrLog EXEC sys.xp_ReadErrorLog @LogNum, @LogType, @ProcessType, @TextSearch
--grab the first occurrence and report back the timestamp as the last startup
DECLARE @LastRestart DATETIME
SELECT @LastRestart = MIN(LogDate) FROM @ErrLog
SELECT @LastRestart AS [Last Restart]
GO
Option 1 : You can use below DMV also to check last start date of SQL Server instance
SELECT SQLServer_Start_Time AS [Last Start Date] FROM sys.dm_os_sys_info
Option 1 : Search the SQL Server error log for process start time.
--search the current sql server error log for the the startup process id
DECLARE @ProcessType VARCHAR(64) = 'Server'
DECLARE @TextSearch VARCHAR(20) = 'Server process ID is'
DECLARE @LogType TINYINT = 1 -- 1 = SQL 2 = Agent
DECLARE @LogNum TINYINT = 0 -- 0 = current 1 =.1 etc
DECLARE @ErrLog AS TABLE([LogDate] DATETIME, [ProcessInfo] VARCHAR(64), [TEXT] VARCHAR(MAX))
INSERT INTO @ErrLog EXEC sys.xp_ReadErrorLog @LogNum, @LogType, @ProcessType, @TextSearch
--grab the first occurrence and report back the timestamp as the last startup
DECLARE @LastRestart DATETIME
SELECT @LastRestart = MIN(LogDate) FROM @ErrLog
SELECT @LastRestart AS [Last Restart]
GO
Option 1 : You can use below DMV also to check last start date of SQL Server instance
SELECT SQLServer_Start_Time AS [Last Start Date] FROM sys.dm_os_sys_info