Hi, I’m new to sqlwatch and I’m trying different things
I’m trying to get an email whenever a database is taken offline. I have the check (created automatically by the system), the action and everything is ok(I have stablished the action to be fired in case the check “fails”).
The check_query is something like
select @output = state
where sql_instance = ‘EMP-SQL3\SQLEXPRESS’
and database_name = ‘borra1’
But state in sqlwacth_meta_database is never updated (if I take offline the database). As far as I can see the procedure [dbo].[usp_sqlwatch_internal_add_database] is the one to maintain the records and values in sqlwatch_meta_datase… It uses a merge to maintain the table
This procedure uses the view dbo.vw_sqlwatch_sys_databases to check the real information of the instance databases… but this view has “where state_desc = ‘ONLINE’ --only online database” in the definition, so any database that is not ONLINE will not be there… therefore in the merge the only field that is updated is “is_current”
Am I missing something?
I know that I can create a custom check that check sys.databases (for instance), but I want to know if this should be working.
Thank you very much