SQL Server Alert using WMI Event ERROR - sql-server-2008

I want to execute a job when ever a file is dropped into a particular folder.
I found some articles that showed me how I can do it on SQL Server.
I created a alert type: WMI Event Alert
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\’ `
The error message returned is:
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 Error: WMI error: 0x80041058
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)
For help, click: 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?
Thanks a lot in advance.

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

In this case, the answer from RRUZ is correct. However there are other possible causes of this error message:
The #wmi_query could not be executed in the #wmi_namespace provided.
One possible reason is the account that runs the Windows service "Windows Management Instrumentation" is disabled as a SQL login. (If you are running SQL 2012+, look for the login 'NT SERVICE\winmgmt').
(Source: Blog by 'rahmanagoro' )
Edit 2020-05-29: I've made a more comprehensive answer to this question on the DBA forum.
Another possible fix is to restart the "Windows Management Instrumentation" service. No idea what leads to the problem, but restarting the service fixes it. I've seen this twice, both times on Windows Server 2008 R2 Standard Edition x64.
Edit 2020-05-29: I've made a more comprehensive answer to this question on the DBA forum.

Related

Agile PLM Unable to extract {0}, see the log for details

I am new to Agile PLM,
I am getting error like Unable to extract {0}, see the log for details message in ATO's.
Can anyone help me to resolve this and root cause for this issue?
Log to Javaclient and try to do Destination reset.
Please check for space on your managed servers. Generally when it is more than 80% occupancy on server this error comes.
Third approach you can do is :
Disable all the Subscribers.
Test destination if it works or not.
4th Approach :
If you are having a clustered environment. You can check ACS configurations :
if ACS.Skips = True in all the server then it's not ideal scenario. It should be true only on one.
Apart from the above suggestions, if your issue is still not resolved, you can try to check if any exception is occurring during extract. I hope, if you are using any clustered environment, ACS is enabled in only one managed server. So expecting that, check out the STDOUT log of the particular managed server (if using WLS) where the ACS is enabled. If the WLS managed servers are installed as Windows Service you need to edit the registry entries for each of them & modify the server start up parameters for each of them to set ACS.Skipserver=true in all but one.
Now, to print the logs, you need to log in to web client, go to tools & settings -> Administration --> Logging configuration --> Set the following entries to DEBUG:
com.agile.acs.PCExtractTask
com.agile.acs.ScheduleMaster
com.agile.acs.ScheduledEventTask
com.agile.extract.server
com.agile.extract.server.ExtractService

Error while creating a custom entity record in mscrm 4.0

I am new to using CRM.I am facing a poblem while creating custome entity record using a console application.
This console application is run with a user having "systemadministrator" privileges.
When I call objService.Creat(entity); method
I am getting the following exception
0x80042f09
SecLib::CheckPrivilege failed. Returned hr = -2147209463, User: 395a4c3e-cf59-de11-8e41-001a646ad2f9
Please let me know what caused this issue.
Thaks in advance.
Its probably because the actual webservice call is not being performed as a system administrator.
I would suggest using a WhoAmI query to check which user is actually being used, then you can correct their permissions.

Retrieve error message in ssis

Is there any way to get a string variable of error message shown in Execution result tab of a package.???
Please help.!
If you are looking for a way to log the information/warning/error messages then you can make use of SSIS logging feature.
Please refer my answer in this Stack Overflow question to understand how to configure the logging feature.
SSIS logging will capture all the messages that are shown in the Execution Results tab. You can also configure it to log the messages that you are interested in.
Hope that helps.
Though this question has already answered i would like to add few points to the question being asked.
Is there any way to get a string variable of error message shown in Execution result tab of a package.
Assume you encountered an error in your SSIS package, now all we need to log that error into your own table (other than SSIS catalog DB's), you can create a Execute SQL task with the INSERT script parameterized. Paramerter you need to use in Parameter Mapping tab is System::ErrorDescription.
INSERT INTO LOG_TABLE(ID,ERROR,ERROR_TIMESTAMP) VALUES(1,?,GETDATE());
Note: You can utilize other System Variables like PackageName,MachineName etc to log into the table.
Please refer screenshot below:

Error when reading control container:Microsoft.WindowsAzure.StorageClient.StorageClientException

I am trying to follow the instructions for the Windows Azure Mysql PHP solution Accelerator ( http://code.msdn.microsoft.com/winazuremysqlphp ) and I get the following error in the Fabric UI and Mysql doesn't start. http://www.pastie.org/1297146
Looks like your diagnostics connection string is bogus... check to make sure it's pointing to a valid account and that the key is correct. Or just disable diagnostics by commenting out DiagnosticMonitor.Start(...) (should be in WorkerRole.cs).

SSIS web service task, can't execute web service

I have a web service that is called from my ssis.
Used to work fine in test mode, when moved to live environment I get the error :
[Web Service Task] Error: An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: Could not execute the Web method. The error is: Object reference not set to an instance of an object.. at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebMethodInvokerProxy.InvokeMethod(DTSWebMethodInfo methodInfo, String serviceName, Object connection) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTaskUtil.Invoke(DTSWebMethodInfo methodInfo, String serviceName, Object connection, VariableDispenser taskVariableDispenser) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()".
We are using a proxy to access the web. Could this be a proxy problem. how to solve ?
Thanks
It was simple proxy issue.
Don't forget to configure the proxy tab in your Http Connection Manager
To help diagnose this, you might try using a script task and adding a Service Reference or Web Reference to the web service. Call the service within a try/catch block and log ex.ToString() if you get an exception. That way, you'll be sure to have all the details, and you can post them here in an edit to your question.
It's also worth noting that SSIS cannot invoke services with spaces in the names. See the following for details:
http://connect.microsoft.com/SQLServer/feedback/details/368606/ssis-web-service-task-cannot-call-services-with-a-space-in-the-name
This answer would have saved me time so I'm adding it in the hope it saves someone else some time.
I had the same problem, except my cause was that I was attempting to pass an integer (Int32) as a web service parameter. It looks like web service parameters in SSIS should always be strings.
I'm using SSIS 2017 and none of the solutions worked for me. But, after changing the SQL Server used by the project, from 2017 to 2016 (or whatever version of SQL is installed), I was able to run the WebService task successfully.
Hope will help somebody.