Archive for May, 2011

Recently i got a below error appeared while opening  a SQL  Server Configuration Manger in SQL Server 2008 Standard Edition.

this error generally some of Management Object File (.mof)  are not installed properly and register during installation of SQL Server.the solution of the issue to register the missing mof file using mofcomp in the command prompt.

1. Stop the WMI (Windows Management Instrumentation) Service in Service console (Services.msc)

2.Rename the Repository to Repository_Old   Folder in “C:\Windows\System32\wbem”

3.Check the mof file Location in SQL Server installed location.

4.Open the Command Prompt run the Below Script.

64bit SQL

C:\Program Files (x86)\Microsoft SQL Server\100\Shared>mofcomp “C:\Program Files
(x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof”

32bit SQL

C:\Program Files\Microsoft SQL Server\100\Shared>mofcomp “C:\Program Files\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof”

5.the Repository Folder Created in “C:\Windows\System32\wbem” Location.

6. The WMI (Windows Management Instrumentation) Service is automatically started in Service console (Services.msc)

7.Now the SQL  Server Configuration Manger Opened.


Read Full Post »

Windows Management Instrumentation (WMI) is a set of functions embedded into the kernel of Microsoft Operating Systems and Servers, including SQL Server. The purpose of WMI is to allow local and remote monitoring and management of servers. It is a standards-based implementation based on the Distributed Management Task Force’s (DMTF) Web-Based Enterprise Management (WBEM) and Common Information Model (CIM) specifications.

What you need to know is that WMI has many events for SQL Server. Search for WMI to get you started in Books Online, and you will discover the many, many events. You can create alerts on these events. Included are Data Definition Language (DDL) events that occur when databases are created or dropped and when tables are created or dropped, for example.

WMI has a language to query these events called Windows Management Instrumentation Query Language (WQL). It is very much like T-SQL, and you will get comfortable with it immediately.

Browse Books Online for the kind of event you wish to monitor. Each event will have a list of attributes, just like a table has a list of columns. Using WMI, you can select the attributes from the event in an alert.

To create an alert, use SQL Serve Management Studio. In Object Explorer, open the SQL Server Agent tree node, right-click Alerts, and choose New Alert. In the Alert Type drop-down box, choose WMI Event Alert.

The namespace will be populated based on the server you are connected to and should look like this:


The period (.) represents the server name, which you can change, such as 

\\MYSQLSERVER\. The last node should be MSSQLSERVER for a default instance and the <instance name> for named instances. In the preceding example, the instance I was running is called SQL2008.

In the textbox, you enter your WQL query, as shown here:


Or you could use this query:


To select only the TSQLCommand Attribute. There will be a pause when you click OK. If your namespace is incorrect, or the syntax or event/attribute names are incorrect, you will get a message immediately.

Then, in your job, you may use the WMI (attribute) event token — in this case:

Print ‘$(ESCAPE_SQUOTE(WMI(TSQLCommand)))’

To get events from a database, Service Broker notifications must be turned on for that database. To turn on Service Broker notifications for AdventureWorks2008, use the following syntax:


If your alerts are occurring but the text replacement for the WMI token is not being done, you probably need to turn on the Service Broker for your database.

The service account that SQL Server Agent uses must have permission on the namespace and ALTER ANY EVENT NOTIFICATION permissions. This will be done automatically if you use SQL Server Configuration Manager to set up accounts. However, to adjust these settings manually, from the Run prompt, type wmimgmt.msc. An administrative dialog will appear, allowing you to set up permissions.

There is a test program for WMI on your server. To run it from the command line, type WBEMTest. It is installed in the WBEM directory of your Windows system directory.

Microsoft has an entire subsection of its Web site devoted to WMI. Just search for WMI on Microsoft Corporation.


Read Full Post »