Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Fu R3 and Earlier

The following query will list all discovered databases, and show whether or not they are fully scanned

Note, the "Type" column refers to what iQuate calls an "Application". To find a list of valid database types in your environment you can use the following query:

SELECT DISTINCT Type FROM [history].[v_DiagnosticsApplicationList]

Not all the results from the above query will be databases, but any discovered database applications will be listed.

Query to list discovered databases

List Databases
SELECT DISTINCT  p.Name as ProjectName	  
      , dal.[DeviceHostname]
      , dal.[IPAddressOrHostname]
      , dal.[DeviceID]
      , dal.[FoundApplicationID]
      , dal.[ApplicationID]
	  , dal.[Name] as ProductName
      , dal.[Status]
      , dal.[Reason]
      , dal.[Vendor]
	  , ad.[Name] AS DBName
	  , ad.Owner AS DBOwner
  FROM [history].[v_DiagnosticsApplicationList] dal
  INNER JOIN [config].[t_Project] p ON p.ProjectID = dal.ProjectID
  LEFT OUTER JOIN [model].[v_ApplicationDatabase] ad ON dal.ApplicationID = ad.ApplicationID
  WHERE (Type = 'Oracle Database Server' or Type = 'SQL Server')
    AND (ad.[DatabaseIdent] NOT IN ('master','tempdb','model','msdb'))

Gwynn R1 and Later

Due to changes in the way scan history tables store their results, the above query no longer works in Gwynn R1. This query returns less information, but should work on all recent versions of iQSonar.

The following query will list all scanned databases (this example is limited to SQL and Oracle)

List of scanned databases
SELECT app.ApplicationID
        , app.Edition
        , app.Version
        , dev.Hostname
        , apq.Qualifier
        , prd.Name as ProductName
        , appdb.Name as AppDBName
        , appdb.DatabaseIdent
FROM [model].[t_Application] app
	INNER JOIN model.v_ApplicationQualifier apq ON app.ApplicationID = apq.ApplicationID
	INNER JOIN model.t_Product prd on prd.ProductID = app.ProductID
	INNER JOIN model.t__Application_Device apd ON app.ApplicationID = apd.ApplicationID
	INNER JOIN model.t_Device dev ON apd.DeviceID = dev.DeviceID
	LEFT OUTER JOIN model.v_ApplicationDatabase appdb ON appdb.ApplicationID = app.ApplicationID
WHERE prd.Name in (N'SQL Server',N'Oracle Database Server')

The following query will list allĀ unscanned databases which have been discovered on hosts that have been scanned.

Discovered but unscanned databases
SELECT fa.FoundApplicationID
     , fa.Edition
	 , fa.Version
	 , prd.Name as ProductName
	 , fa.DeviceID
	 , fa.BuildNumber
	 , fa.Path
	 , faIP.IPAddress
	 , faHN.Hostname
FROM model.t_FoundApplication fa
	INNER JOIN model.t_Product prd on prd.ProductID = fa.ProductID
	INNER JOIN model.v_FoundApplicationIPAddress faIP ON faIP.FoundApplicationID = fa.FoundApplicationID
	LEFT OUTER JOIN model.v_FoundApplicationHostname faHN ON faHN.FoundApplicationID = fa.FoundApplicationID
WHERE prd.Name in (N'SQL Server',N'Oracle Database Server')
  AND fa.DeviceID IS NOT NULL
  AND fa.ApplicationID IS NULL
  • No labels