locked
Record STOP/START time of SQL SERVER SERVICES RRS feed

  • Question

  • Hi all,
    How can i figure out when sql server stopped?For security purpose
    for security purpose I need to record all start/stop of sql server services in a table.
    How can i do that?
    --yousef
    Tuesday, December 28, 2010 7:55 PM

Answers

  • That information is recorded in the error logs, so you can read them.  There are a couple of undocumented stored procedures that get used. 

    For a tip on how to get started, see Peso's 08/17/2006 05:58 post in: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=70620

    Every log record is a row returned and you can search it for the rows that you care about which indicate shutdown or startup.

    Of course, you can write you own code to read these log files if you prefer not to use undocumented and therefore changable procedures.

    RLF

     

    • Proposed as answer by Lekss Tuesday, December 28, 2010 11:01 PM
    • Marked as answer by Yousef Ekhtiari Wednesday, December 29, 2010 6:33 AM
    Tuesday, December 28, 2010 10:13 PM
  • You can also get throgh data of TEMPDB....

    For the stop of the services you can go for event viewer

    For the start of the services you can use the below query

    select

     

    crdate,* from sys.sysdatabases where dbid=2

    Regards,

    Aditya

    Wednesday, December 29, 2010 6:45 PM

All replies

  • That information is recorded in the error logs, so you can read them.  There are a couple of undocumented stored procedures that get used. 

    For a tip on how to get started, see Peso's 08/17/2006 05:58 post in: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=70620

    Every log record is a row returned and you can search it for the rows that you care about which indicate shutdown or startup.

    Of course, you can write you own code to read these log files if you prefer not to use undocumented and therefore changable procedures.

    RLF

     

    • Proposed as answer by Lekss Tuesday, December 28, 2010 11:01 PM
    • Marked as answer by Yousef Ekhtiari Wednesday, December 29, 2010 6:33 AM
    Tuesday, December 28, 2010 10:13 PM
  • Thank you very much Russell.
    --yousef
    Wednesday, December 29, 2010 6:32 AM
  • You can also get throgh data of TEMPDB....

    For the stop of the services you can go for event viewer

    For the start of the services you can use the below query

    select

     

    crdate,* from sys.sysdatabases where dbid=2

    Regards,

    Aditya

    Wednesday, December 29, 2010 6:45 PM