Monday, January 31, 2011

Query to Check the SQL Server Restart time

You can simply run one of the below query to check the SQL Server last restart time.

[sourcecode language="sql"]

SELECT Dateadd(s, ( ( -1 ) * ( osd.[ms_ticks] / 1000 ) ), Getdate()) AS serverrestartdatetime,
osd.sqlserver_start_time
FROM sys.[dm_os_sys_info] osd;

OR

SELECT name,
crdate
FROM sys.sysdatabases
WHERE name = 'tempdb'
[/sourcecode]

No comments:

Post a Comment