Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



dbo.sp_sysutility_ucp_calculate_aggregated_mi_health

  No additional text.


Syntax
CREATE PROCEDURE dbo.sp_sysutility_ucp_calculate_aggregated_mi_health
   @new_set_number INT
WITH EXECUTE AS OWNER
AS
BEGIN
    -- ManagedInstanceCount
    DECLARE @mi_count INT = 0
    SELECT @mi_count = COUNT(*)
    FROM msdb.dbo.sysutility_ucp_mi_health_internal hs
    WHERE hs.set_number = @new_set_number
    -- ManagedInstanceOverUtilizeCount
    DECLARE @mi_over_utilize_count INT = 0
    SELECT @mi_over_utilize_count = COUNT(*)
    FROM msdb.dbo.sysutility_ucp_mi_health_internal hs
    WHERE hs.set_number = @new_set_number AND
          (0 != hs.is_volume_space_over_utilized OR
           0 != hs.is_computer_processor_over_utilized OR
           0 != hs.is_file_space_over_utilized OR
           0 != hs.is_mi_processor_over_utilized)
    -- ManagedInstanceUnderUtilizeCount
    DECLARE @mi_under_utilize_count INT = 0
    SELECT @mi_under_utilize_count = COUNT(*)
    FROM msdb.dbo.sysutility_ucp_mi_health_internal hs
    WHERE hs.set_number = @new_set_number AND
          (0 != hs.is_volume_space_under_utilized OR
           0 != hs.is_computer_processor_under_utilized OR
           0 != hs.is_file_space_under_utilized OR
           0 != hs.is_mi_processor_under_utilized)
           AND 0 = hs.is_volume_space_over_utilized
           AND 0 = hs.is_computer_processor_over_utilized
           AND 0 = hs.is_file_space_over_utilized
           AND 0 = hs.is_mi_processor_over_utilized	
    	
    -- ManagedInstanceUnhealthyCount
    DECLARE @mi_unhealthy_count INT = 0
    SELECT @mi_unhealthy_count = @mi_over_utilize_count + @mi_under_utilize_count
    -- ManagedInstanceHealthyCount
    DECLARE @mi_healthy_count INT = 0
    SELECT @mi_healthy_count = COUNT(*)
    FROM msdb.dbo.sysutility_ucp_mi_health_internal hs
    WHERE hs.set_number = @new_set_number
    AND 0 = hs.is_volume_space_under_utilized
    AND 0 = hs.is_computer_processor_under_utilized
    AND 0 = hs.is_file_space_under_utilized
    AND 0 = hs.is_mi_processor_under_utilized
    AND 0 = hs.is_volume_space_over_utilized
    AND 0 = hs.is_computer_processor_over_utilized
    AND 0 = hs.is_file_space_over_utilized
    AND 0 = hs.is_mi_processor_over_utilized
    -- Insert new record
    INSERT INTO msdb.dbo.sysutility_ucp_aggregated_mi_health_internal(set_number
           , mi_count
           , mi_healthy_count
           , mi_unhealthy_count
           , mi_over_utilize_count
           , mi_under_utilize_count
           , mi_on_over_utilized_computer_count
           , mi_on_under_utilized_computer_count
           , mi_with_files_on_over_utilized_volume_count
           , mi_with_files_on_under_utilized_volume_count
           , mi_with_over_utilized_file_count
           , mi_with_under_utilized_file_count
           , mi_with_over_utilized_processor_count
           , mi_with_under_utilized_processor_count)
    SELECT @new_set_number
            , @mi_count
            , @mi_healthy_count
            , @mi_unhealthy_count
            , @mi_over_utilize_count
            , @mi_under_utilize_count
            , ISNULL(SUM(CASE WHEN 0 < hs.is_computer_processor_over_utilized THEN 1 ELSE 0 END), 0)
            , ISNULL(SUM(CASE WHEN 0 < hs.is_computer_processor_under_utilized THEN 1 ELSE 0 END), 0)
            , ISNULL(SUM(CASE WHEN 0 < hs.is_volume_space_over_utilized THEN 1 ELSE 0 END), 0)
            , ISNULL(SUM(CASE WHEN 0 < hs.is_volume_space_under_utilized THEN 1 ELSE 0 END), 0)
            , ISNULL(SUM(CASE WHEN 0 < hs.is_file_space_over_utilized THEN 1 ELSE 0 END), 0)
            , ISNULL(SUM(CASE WHEN 0 < hs.is_file_space_under_utilized THEN 1 ELSE 0 END), 0)
            , ISNULL(SUM(CASE WHEN 0 < hs.is_mi_processor_over_utilized THEN 1 ELSE 0 END), 0)
            , ISNULL(SUM(CASE WHEN 0 < hs.is_mi_processor_under_utilized THEN 1 ELSE 0 END), 0)
    FROM msdb.dbo.sysutility_ucp_mi_health_internal hs
    WHERE hs.set_number = @new_set_number
END
 
Last revision
See also

  sp_sysutility_ucp_calculate_health (Procedure)
sp_sysutility_ucp_remove_mi (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash