Windows event 17162 (for restart of SQL Server) not shown in event viewer.

DM 546 Reputation points
2022-10-06T18:36:17.08+00:00

I am trying to extract restart time of SQL Server from Windows event viewer. However; it is not shown. My server hasn't restarted from last 3 weeks approximately. Can it be because something is causing old events to be wiped out. Please guide. Thank you.

SQL Server | Other
{count} votes

Accepted answer
  1. Seeya Xi-MSFT 16,586 Reputation points
    2022-10-07T02:54:53.797+00:00

    Hi @DM ,

    Welcome to Microsoft Q&A!
    There is an easier way to know when SQL Server was last restarted, such as using sys.dm_os_sys_info.
    248345-image.png

    Of course there are other methods, and I have made a list of them.
    Method 1--> errorlog
    sp_readerrorlog 0,1,'Copyright (c)'
    Method 2--> tempdb creation
    SELECT create_date FROM sys.databases WHERE name = 'tempdb'
    Method 3--> sqlserver start time in sys.dm_os_sys_info
    SELECT sqlserver_start_time FROM sys.dm_os_sys_info
    Method 4--> session_id from sys.dm_exec_sessions
    SELECT login_time FROM sys.dm_exec_sessions WHERE session_id = 1
    Method 5--> Dashbord
    Right click on the server name in SSMS and select Reports > Standard Reports > Server Dashboard and you will get a report similar to below report.
    Method 6--> Event viewer
    This is the method you are using. (The blog I posted below mentions event 17163. but tested it in my environment and it is event 17162)
    The blog I posted below mentions event 17163. but tested it in my environment and it is event 17162. If you don't find the corresponding event through the filter, then it should be a windows event missing issue. You can check this link and find the solution.

    If you want to take a look at the screenshots of these methods above by the way, you can take a look at this Microsoft article: SQL Server: Find Windows and SQL Server Last Restart Time.

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.