1、Objectives After completing this lesson,you should be able to do the following:View metrics by using the metrics history views Create metric thresholds View alerts Create metric baselines Enable adaptive thresholdsMetrics,Alerts,and Baselines Metric:Rate of change in a cumulative statistic Alert:Eve
2、nt generated when a monitored metric crosses a threshold Baseline:Data gathered from a“normal running database”for performance comparisonLimitation of Base Statistics30 minutes30 minutesV$SYSSTATPhysical readsI/OI/OTimeTimeLow rateHigh rateStatistics just keep growing.2M2MTypical Delta Tools Compari
3、son of statistics at two points in time is needed.The following tools produce deltas:Statspack AWR reports Customized scriptsOracle Database 10g Solution:MetricsBase statistic 1Redo generationMetric 1Metric 2Redo generation/TxClient 1Client 2Client 3Client 4V$METRICNAMEV$SYSMETRICV$SESSMETRICV$FILEM
4、ETRICV$EVENTMETRICMMONUser commitUser rollbackV$WAITCLASSMETRICV$SERVICEMETRICBenefits of MetricsDBAAnalyze differences.Query a metric.Without metricsWith metricsViewing Metric History Information In memory:V$SYSMETRIC_HISTORYV$FILEMETRIC_HISTORYV$WAITCLASSMETRIC_HISTORYV$SERVICEMETRIC_HISTORYV$SESS
5、ION_WAIT_HISTORY(last 10 events)On disk:DBA_HIST_SYSMETRIC_SUMMARYDBA_HIST_SYSMETRIC_HISTORY(alerts only)DBA_HIST_SESSMETRIC_HISTORYDBA_HIST_SYSTEM_EVENT(cumulative)DBA_HIST_FILEMETRIC_HISTORY(alerts only)DBA_HIST_FILESTATXS(cumulative)DBA_HIST_WAITCLASSMET_HISTORY(alert)Viewing Detailed Information
6、 for a MetricStatistic Histograms30 minutesV$SYSSTATPhysical readsI/OTimeHigh rate1248163264 128 256 512222NumberofwaitsTimeperiodV$FILE_HISTOGRAMIs it areal problem?5500Histogram Views V$EVENT_HISTOGRAM:For each event such as“db file sequential read”V$FILE_HISTOGRAM:For single block reads on a per
7、data file basis V$TEMP_HISTOGRAM:For single block reads on a per temp-file basisServer-Generated AlertsServeralertsqueue.Metric exceedsthreshold.AWREnterprise ManagerOracle instanceDatabase Control Usage ModelSet up notification rules(paging,e-mail).Correct the problem.Review alert details and advic
8、e.Enable alerts by setting thresholds.Receive notification.Verify that the problem is resolved.Setting ThresholdsCreating and Testing an Alert1.Specify a threshold.2.Create a test case.3.Check for an alert.213Metric and Alert ViewsRecent metricsMetric historyV$SYSMETRIC_HISTORYV$SYSMETRICV$SERVICEME
9、TRICV$METRICNAME.DBA_HIST_SYSMETRIC_HISTORY.DBA_OUTSTANDING_ALERTSDBA_ALERT_HISTORYDBA_THRESHOLDSV$ALERT_TYPES.Server alertsUser-Defined SQL MetricsPractice Overview:Work with Metrics This practice covers the following topics:View metrics using the metrics history views Create metric thresholds View
10、 alerts Clear alertsWorking with Metric Baselines Enable metric baselines.Create a metric baseline.Static baseline Moving window baseline View the baseline statistics.Set a threshold on a baseline.Fixed threshold(percent of maximum)Adaptive thresholdEnabling Metric BaseliningCreating Static Metric B
11、aselinesCreating Static Metric BaselinesTime GroupingBaseline periodTimegroupedDayand nightHourof dayWeekdaysand weekendDayof weekAllhoursAlldays8am11am7am7am7pm7am7am7pmMoSuMoSuMoSa&SuDailyWeeklyTime Grouping:ConsiderationsMo Tu We Th Fr Sa SuNoSufficient data?Day of weekGrouped by7 daysMoving wind
12、ow sizeYesSufficient data?Day of weekGrouped by14 daysMoving window sizeYesSufficient data?Weekdays and weekendGrouped by7 daysMoving window sizeDatapointsWeekdays WeekendMo Tu We Th Fr Sa SuDatapointsDatapointsSufficiency level1 week ago2 weeks agoActivating the StaticMetric BaselineActivating the
13、Moving WindowMetric BaselineVisualizing Metric Baseline StatisticsSetting Adaptive Alert ThresholdsSetting Adaptive Alert ThresholdsMetric Baseline and Adaptive Threshold:Considerations Baselining must be enabled using Enterprise Manager.Only one moving window baseline can be defined.Multiple static
14、 baselines can be defined.Only one baseline can be active at a time.Adaptive thresholds require an active baseline.Classification of Eligible MetricsDatabase Time(centiseconds per second)Response Time(per transaction)System Response Time(centiseconds)Performance MetricsExecutes(per second)Redo Gener
15、ated(per second)Network Bytes(per second)Physical Writes(per second)Physical Reads(per second)Current Logons CountUser Calls(per second)Number of Transactions(per second)Workload Volume Metrics Database Block Changes(per transaction)Enqueue Requests(per transaction)Total Parses(per transaction)Sessi
16、on Logical Reads(per transaction)Workload Type MetricsMetric Baseline:Normalized ViewConfiguring Normalization MetricsAdaptive Thresholds and the All Metrics PagePractice Overview:Work with Baselines This practice covers the following topics:Create a static metric baseline View the baseline data Enable adaptive thresholds View deviations from the baseline Summary In this lesson,you should have learned how to:View metrics by using the metrics history views Create metric thresholds View alerts Create metric baselines Enable adaptive thresholds