Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SQL Server Administration (2012)
 mirroring alert

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2014-01-27 : 05:33:16
I define the following alert:
http://technet.microsoft.com/en-us/library/cc966392.aspx


DECLARE @namespace NVARCHAR(200);
SET @namespace = N'\\.\root\Microsoft\SqlServer\ServerEvents\'
+ CONVERT(NCHAR(128), SERVERPROPERTY('InstanceName'));

DECLARE @alertName NVARCHAR(100)
SET @alertName = N'DB Mirroring: State Changes'
IF EXISTS ( select * from dbo.sysalerts WHERE name = @alertName )
EXEC msdb.dbo.sp_delete_alert @name = @alertName

EXEC msdb.dbo.sp_add_alert @name=@alertName,
@message_id=0,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=0,
@notification_message=N'warning mirror state change',
@category_name = @CategoryName, -- Mirroring
@wmi_namespace = @namespace,
@wmi_query=N'SELECT * from DATABASE_MIRRORING_STATE_CHANGE',
@job_name = N'DB Mirroring: Record State Changes'

BUT, it doesn't work.
I see in the error log:

[422] Unable to register the alert DB Mirroring: State Changes with WMI provider. The alert is ignored. WMI error 0x8004100e



Noam Graizer
   

- Advertisement -