when was sql server stopped?

  • Is there way to tell when was sql server stopped? I know i can look in the sql server logs but that only tells me when sql server was started.

     

    thanks

  • Look on the server's application log in event viewer.

  • is there any table that I can query? I dont have access to the box sql server is running on.

  • xp_readerrorlog will display the last error log. Then you can feed it integer parameters to see the previous logs.

    exec master.dbo.xp_readerrorlog 1

    That will show the last log generated before the current one, your stop request should be the final row.

  • Theoretically the last record should show the request to stop.

    This will also work:

    Copy the following VB Script code to Notepad, save for example as C:\CheckSQLStop.vbs and run either by itself on the server or specifying the machine name if you have admin rights (that you don't have as you say) or running in Query Analyzer which will execute as SQL Server startup account. This will work on Windows XP and Windows 2003 

    xp_cmdshell

    "cscript C:\CheckSQLStop.vbs"

    ' Code for CheckSQLStop.vbs

    ' This is modified example from Scriptomatic Tool - generated code

    On Error Resume Next

    strComputer = "."

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    Set colItems = objWMIService.ExecQuery("Select * from Win32_NTLogEvent where " _

    & "Logfile = 'Application' and eventcode = '17147'",,48)

    For Each objItem in colItems

        Wscript.Echo "Category: " & objItem.Category

        Wscript.Echo "CategoryString: " & objItem.CategoryString

        Wscript.Echo "ComputerName: " & objItem.ComputerName

        Wscript.Echo "Data: " & objItem.Data

        Wscript.Echo "EventCode: " & objItem.EventCode

        Wscript.Echo "EventIdentifier: " & objItem.EventIdentifier

        Wscript.Echo "EventType: " & objItem.EventType

        Wscript.Echo "InsertionStrings: " & objItem.InsertionStrings

        Wscript.Echo "Logfile: " & objItem.Logfile

        Wscript.Echo "Message: " & objItem.Message

        Wscript.Echo "RecordNumber: " & objItem.RecordNumber

        Wscript.Echo "SourceName: " & objItem.SourceName

        Wscript.Echo "TimeGenerated: " & objItem.TimeGenerated

        Wscript.Echo "TimeWritten: " & objItem.TimeWritten

        Wscript.Echo "Type: " & objItem.Type

        Wscript.Echo "User: " & objItem.User

    Next

     

    Regards,Yelena Varsha

Viewing 5 posts - 1 through 4 (of 4 total)

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