請參考下面的範例 .謝謝
****************************************************************
select ObjectName, CounterName, convert(varchar(10), DateTime, 120) DateTime, Path,
****************************************************************
select ObjectName, CounterName, convert(varchar(10), DateTime, 120) DateTime, Path,
FullName, SUM(SampleCount) SampleCount, Sum(AverageValue *
SampleCount) /
SUM(SampleCount) AverageValue, Min(MinValue) MinValue,
Max(MaxValue) MaxValue
from
OperationsManagerDW.Perf.vPerfHourly AS vPerf
INNER JOIN
OperationsManagerDW.dbo.vPerformanceRuleInstance vPRI ON
vPRI.PerformanceRuleInstanceRowId =
vPerf.PerformanceRuleInstanceRowId
INNER JOIN
OperationsManagerDW.dbo.vManagedEntity vME ON
vPerf.ManagedEntityRowId =
vME.ManagedEntityRowId
INNER JOIN
OperationsManagerDW.dbo.vPerformanceRule vPR ON vPRI.RuleRowId =
vPR.RuleRowId and
vPR.ObjectName in ('Processor', 'Memory', 'LogicalDisk')
group by ObjectName, CounterName, convert(varchar(10), DateTime,
120), ObjectName,
Path, FullName
union all
select ObjectName, CounterName, Convert(varchar(10), DateTime,
120) DateTime, Path,
FullName, SampleCount, AverageValue, MinValue, MaxValue
from OperationsManagerDW.Perf.vPerfDaily AS vPerf
INNER JOIN
OperationsManagerDW.dbo.vPerformanceRuleInstance vPRI ON
vPRI.PerformanceRuleInstanceRowId =
vPerf.PerformanceRuleInstanceRowId
INNER JOIN
OperationsManagerDW.dbo.vManagedEntity vME ON
vPerf.ManagedEntityRowId =
vME.ManagedEntityRowId
INNER JOIN
OperationsManagerDW.dbo.vPerformanceRule vPR ON vPRI.RuleRowId =
vPR.RuleRowId and
vPR.ObjectName in ('Processor', 'Memory', 'LogicalDisk')
order by DateTime
沒有留言:
張貼留言