cancel
Showing results for 
Search instead for 
Did you mean: 
aborders1
Level 7

Monitoring a Database

Jump to solution

r2Is there a fairly easy way to monitor the status of a database (Online vs Offline) using the Server and Application Monitor? I think I may have to create a custom application monitor but am wondering if someone else has something already.

I have an application that fails about every two to three weeks. When it fails I find that the database is offline. The database server (SQL 2008 R2) is still fine though. I cannot find any reason in the server logs or the SQL logs for the DB to be offline. I would like to setup an alert when this happens so I can try and track it with little impact to my end users.

Thanks for any ideas.

Adam

0 Kudos
2 Replies
Highlighted
aLTeReGo
Level 21

Re: Monitoring a Database

Jump to solution

The following SQL query below can be used to return the status of your database. Simpy replace "YourDatabaseName" with the name of the database you wish to monitor. I've actually taken the example below and created an application template that I've posted to the content exchange here on Thwack so you can easily import into SAM. It can be downloaded from here.

SELECT

                [state]

                ,state_desc

FROM

sys.databases

WHERE

                Name = ‘YourDatabaseName’


aborders1
Level 7

Re: Monitoring a Database

Jump to solution

The SQL User experience template you built works great. Thanks for the help.

Adam

0 Kudos