Clarity

 View Only
  • 1.  How to get DB status of SQL Server for the past one day?

    Posted Dec 11, 2017 11:22 AM

    I wanted to know whether my DB is UP or Down for the past one day. Can we achieve this by writing any query? If yes please let me know.

     

    Thanks in Advance. 



  • 2.  Re: How to get DB status of SQL Server for the past one day?

    Posted Dec 11, 2017 11:33 AM

    Ummmm if your DB is down, not sure any query is going to help you!

     

    Google suggests things like ; Find out how long the sql server service has been running, from t-sql - Stack Overflow 

     

    The application log files will report errors what the application can not connect to the database though - you could look in there?



  • 3.  Re: How to get DB status of SQL Server for the past one day?

    Posted Dec 11, 2017 11:42 AM

    Hi Dave,

    Greetings!!

     

    I wanted to know the next day whether there is any Database Down or anything I want to put them in a process thus I cant use Logs for that. Also, can I know the same for Dataware house Status as well? 

     

    Thanks,

    Vamshi



  • 4.  Re: How to get DB status of SQL Server for the past one day?

    Posted Dec 11, 2017 11:47 AM

    Have you even looked at the link I gave you?



  • 5.  Re: How to get DB status of SQL Server for the past one day?

    Posted Dec 11, 2017 11:53 AM

    Yes, I did. In that link, We have db created date info.



  • 6.  Re: How to get DB status of SQL Server for the past one day?

    Posted Dec 11, 2017 11:58 AM

    No, you have the created date of the tempdb, which apparently tells you when the database was last started.



  • 7.  Re: How to get DB status of SQL Server for the past one day?

    Posted Dec 11, 2017 01:10 PM

    I would check the event application logs for events which have a source of MSSQLSERVER.

     

     

    If you know what you are looking for in these events,  you could write a small powershell script to query for specific types of events.

     

    $Date = (Get-Date).AddDays(-1)
    Get-WinEvent @{logname='application';id=17137; StartTime = $Date } | select logname, timecreated, id, message

     

     

    V/r,

    Gene