December 21, 2011 at 10:24 am
Is there an easy way within SQL Server (no xp_cmdshell or anything like that) to get the last Windows reboot time? I can get SQL Servers' through various queries but I'd like to get Windows restart as well if possible.
Thanks.
December 21, 2011 at 10:48 am
To get the last time the sql service restarted you can use:
Kevin Devine says:
select login_time from master.sys.sysprocesses where cmd='LAZY WRITER'
source: http://www.sqldbadiaries.com/2011/03/14/find-the-last-reboot-time-of-the-server/
This article also shows techniques from the server also.
December 21, 2011 at 11:16 am
This query will give the last windows restart time.
SELECT
DATEADD(s,((-1)*([ms_ticks]/1000)),GETDATE()) AS last_restart
FROM sys.[dm_os_sys_info];
December 21, 2011 at 12:27 pm
Nice scripts to get last server restart.
December 22, 2011 at 11:33 am
Thanks everyone. I'll be taking bits and pieces of these for our diagnostics/reporting.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply