Server RestartTime vs Service RestartTime

  • i know of a couple of ways to get a good handle on when the SQL service was restarted; there's a method with xp_readerror log, but i like to use either of a couple of DMV's for the when the Service was last started.

    --sqlserver_start_time

    --2016-03-29 08:34:07.890

    --create_date

    --2016-03-29 08:34:13.087

    SELECT sqlserver_start_time from sys.dm_os_sys_info i;

    select create_date from sys.databases where name='tempdb';

    but what about the Server itself? i poked around the dmv's and don't see anything to show that, for example , the server last rebooted in January, but the SQL service was restarted a month ago.

    do i have to do bigint math on ticks from dm_os_sys_info ?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • answering my own question, by converting ms_ticks to seconds, i think i see what i was after:

    --ServerRestartTimeServiceRestartTimeServiceUpTimeInDays

    2015-08-22 21:46:51.9802016-03-29 08:34:07.89087

    -- select

    DATEADD(second, -1 * ( ms_ticks / 1000),getdate()) as ServerRestartTime,

    i.sqlserver_start_time As ServiceRestartTime,

    DATEDIFF(dd,i.sqlserver_start_time,GETDATE()) AS ServiceUpTimeInDays

    from sys.dm_os_sys_info i;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • This was removed by the editor as SPAM

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply