使用WMI事件错误的SQL Server警报 [英] SQL Server Alert using WMI Event ERROR

查看:143
本文介绍了使用WMI事件错误的SQL Server警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在文件放到特定文件夹中时执行作业。

I want to execute a job when ever a file is dropped into a particular folder.

我找到了一些文章,向我展示了如何在SQL Server上执行该操作。

I found some articles that showed me how I can do it on SQL Server.

我创建了警报类型: WMI事件警报

对于名称空间,其SQL实例自动以 \\.\\root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER

For the name space its the SQL instance which comes automatically as \\.\root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER

在查询部分-我编写了以下查询,

On the Query section - I wrote the below query ,

SELECT * 
FROM __InstanceCreationEvent 
WITHIN 1 
WHERE TargetInstance ISA 'CIM_DataFile' 
AND TargetInstance.Name = ‘c:\\TestFolder\’ `

返回的错误消息是:

Cannot create new alert. 

ADDITIONAL INFORMATION:

Create failed for Alert 'AlertTest'.  (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2425.0+((KJ_PCU_Main).110406-2044+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Alert&LinkId=20476

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

SQLServerAgent错误: WMI错误:0x80041058

SQLServerAgent Error: WMI error: 0x80041058

@wmi_query 不能在 @中执行提供了wmi_namespace 。验证名称空间中是否存在在查询中选择的事件类,并且该查询具有正确的语法。 (Microsoft SQL Server,错误:22022)

The @wmi_query could not be executed in the @wmi_namespace provided. Verify that an event class selected in the query exists in the namespace and that the query has the correct syntax. (Microsoft SQL Server, Error: 22022)

有关帮助,请单击: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer= 10.50.2425& EvtSrc = MSSQLServer& EvtID = 22022& LinkId = 20476

请告知我查询是否正确以及是否还有其他问题需要检查吗?

Please may you advise if my Query is correct and if there is anything else I need to check?

非常感谢。

推荐答案

您使用了错误的名称空间, CIM_DataFile WMI类是 \root\CIMV2 命名空间的一部分,而不是 \root\Microsoft\ SqlServer\ServerEvents\MSSQLSERVER

You are using the wrong namespace, the CIM_DataFile WMI class is part of the \root\CIMV2 namespace and not of \root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER

这篇关于使用WMI事件错误的SQL Server警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆