SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


when was sql server stopped?


when was sql server stopped?

Author
Message
sqlstar2011
sqlstar2011
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2379 Visits: 592

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


Ray M
Ray M
SSCrazy Eights
SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)

Group: General Forum Members
Points: 8835 Visits: 1076

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


sqlstar2011
sqlstar2011
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2379 Visits: 592
is there any table that I can query? I dont have access to the box sql server is running on.
Aaron Ingold
Aaron Ingold
SSCarpal Tunnel
SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)

Group: General Forum Members
Points: 4383 Visits: 222
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.
Yelena Varshal
Yelena Varshal
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14602 Visits: 607

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 Varshal

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search