MS SQL Server database discovery error

Rahman4
Tera Guru

Hi,

I am trying to discovery MS SQL Server database catalogues within a SQL server 2008 data. The discovery process identifies the Sql Server 2008 instance as "RusOn" dependency, however when I click on the Instance name I cannot see the database catalogues. The log file shows the followings:

find_real_file.png

Clicking the error pops up the Horizontal Discovery log where I can "Debug" it. While debugging I get this error:

find_real_file.png

 

Just by looking at it seems like the class is not correct. I can run the following command in Powershell and it gives me the same error.

gwmi -Query "SELECT Name FROM Win32_PerfFormattedData_MSSQLMSSQLSERVER2008_MSSQLMSSQLSERVER2008Databases"

gwmi : Invalid class "Win32_PerfFormattedData_MSSQLMSSQLSERVER2008_MSSQLMSSQLSERVER2008Databases"
At line:1 char:1
+ gwmi -Query "SELECT Name FROM Win32_PerfFormattedData_MSSQLMSSQLSERVE ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Not sure what the issue is and where to start?

Any comments will be appreciated.

 

TIA

 

2 REPLIES 2

DaveHertel
Kilo Sage
Kilo Sage

Hi Raz -- have you setup the MID server with the pre-req's needed to Discovery SQL?  As well as defined SQL credentials? In case you aren't aware, both are needed for Discovery to uncover deeper sql-specific objects (like instance/catalog info). 
  While I'm not sure that is the root cause in your case (since you get the same issue via PowerShell), its worth verifying...

Hope this helps..

Hi,

Thanks for the reply. Yes I have installed all the pre-requisites for the discovery. The code that tries to query the WMI class is generated inside the "MSSQL DB On Windows" pattern and I just want to make sure its valid:

EVAL(def instance = ctx.getAttribute("instance_name");def command="";if(instance == "MSSQLSERVER"){  command = "SELECT Name FROM Win32_PerfFormattedData_MSSQLSERVER_SQLServerDatabases";}else{  command = "SELECT Name FROM Win32_PerfFormattedData_MSSQL"+instance+"_MSSQL"+instance+"Databases";}def result;try{  result = ctx.getCommandManager().wmiQuery(command, ctx).toString();} catch (Exception e){   instance = instance.replaceAll("_","");  command = "SELECT Name FROM Win32_PerfFormattedData_MSSQL"+instance+"_MSSQL"+instance+"Databases";  result = ctx.getCommandManager().wmiQuery(command, ctx).toString();} return result;)

 

I have feeling that the query that above code is generating is not correct? 

SELECT Name FROM Win32_PerfFormattedData_MSSQLMSSQLSERVER2008_MSSQLMSSQLSERVER2008Databases

 

I am not a WMI exppert though.

Thanks,