You are on page 1of 19

Using Metrics and Alerts

Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


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

5-2 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Metrics and Alerts

• Metric: Rate of change in a cumulative statistic


• Alert: Event generated when a monitored metric crosses a
threshold

5-3 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Limitation of Base Statistics

2M

High rate
V$SYSSTAT
I/O
Physical reads 30 minutes

Time
2M
Low rate

30 minutes
I/O
Statistics just keep
growing.

Time

5-4 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Typical Delta Tools

• Comparison of statistics at two points in time is needed.


• The following tools produce deltas:
– AWR reports
– Statspack
– Customized scripts

5-5 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Oracle Database 11g Solution: Metrics

V$SYSMETRIC V$FILEMETRIC
V$METRICNAME
V$SESSMETRIC V$EVENTMETRIC

V$SERVICEMETRIC V$WAITCLASSMETRIC

Client 1 Client 2 Client 3 Client 4

MMON Metric 1 Metric 2 Redo generation/Tx

Base statistic 1

Redo generation User commit User rollback

5-6 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Benefits of Metrics

DBA

Query a metric.
Analyze differences.

Without metrics With metrics

5-7 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Viewing Metric History Information

• In memory:
– V$SYSMETRIC_HISTORY (last hour)
– V$FILEMETRIC_HISTORY
– V$WAITCLASSMETRIC_HISTORY (last hour)
– V$SERVICEMETRIC_HISTORY
– V$SESSION_WAIT_HISTORY (last 10 events)
• On disk:
– DBA_HIST_SYSMETRIC_SUMMARY
– DBA_HIST_SYSMETRIC_HISTORY
– DBA_HIST_SESSMETRIC_HISTORY
– DBA_HIST_SYSTEM_EVENT (cumulative)
– DBA_HIST_FILEMETRIC_HISTORY (alerts only)
– DBA_HIST_FILESTATXS (cumulative)
– DBA_HIST_WAITCLASSMET_HISTORY (alert)

5-8 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Using EM to View Metric Details

5-9 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Statistic Histograms

High rate
V$SYSSTAT
I/O
Physical reads 30 minutes

Time Is it a
real
5500 problem?
V$FILE_HISTOGRAM
Number
of
waits

Time
1 2 4 8 16 32 64 128 256 512 … 222 period

5 - 10 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Histogram Views

• V$EVENT_HISTOGRAM: For each event such as “db file


sequential read”
• V$FILE_HISTOGRAM: For single block reads on a per
data file basis

5 - 11 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Server-Generated Alerts

Enterprise Manager

Alert
queue
Oracle
instance
Metric exceeds
threshold.

AWR

5 - 12 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Alert Usage Model

Enable alerts by setting thresholds.

Set up notification rules (paging, email).

Receive notification.

Review alert details and advice.

Correct the problem.

Verify that the problem is resolved.

5 - 13 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Setting Thresholds

5 - 14 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Creating and Testing an Alert

1. Specify a threshold.
2. Create a test case.
3. Check for an alert.

5 - 15 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Metric and Alert Views

Recent metrics Metric history Server alerts

DBA_HIST_SYSMETRIC_HISTORY
...

DBA_OUTSTANDING_ALERTS
V$SYSMETRIC_HISTORY
DBA_ALERT_HISTORY
V$SYSMETRIC
DBA_THRESHOLDS
V$SERVICEMETRIC
V$ALERT_TYPES
V$METRICNAME
...
...

5 - 16 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Quiz

An alert appeared on the Enterprise Manager database about


two hours ago, and then disappeared. You do not remember
the text. You can look in DBA_ALERT_HISTORY to find the
cleared alert.
a. True
b. False

5 - 17 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Summary

In this lesson, you should have learned how to:


• View metrics by using the metrics history views
• Create metric thresholds
• View alerts

5 - 18 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.


Practice Overview 5:
Working with Metrics
This practice covers the following topics:
• Viewing metrics using the metrics history views
• Creating metric thresholds
• Viewing alerts
• Clearing alerts

5 - 19 Copyright © 2010, Oracle and/or its affiliates. All rights reserved.