Oracle Alerts 與 Metrics(警告與度量)說明

來源:互聯網
上載者:User

一.Alerts 和 Metrics說明

官方連結:

Monitoring and Tuning the Database

http://docs.oracle.com/cd/E11882_01/server.112/e10897/montune.htm#CACCIHAB

 

Alerts help you monitor your database. Most alerts notify youof when particular metric thresholds are exceeded.For each alert, you can set critical and warning threshold values. Thesethreshold values are meant to be boundary values that when exceeded, indicatethat the system is in an undesirable state. For example, when a tablespacebecomes 97 percent full, this can be considered undesirable, and OracleDatabase generates a critical alert.

--Alerts 可以協助我們監控資料庫,大部分alerts 資訊都是超過metric thresholds。 對於每一個alert,都可以設定critical和 warning threshold值。 當系統達到這個alert時,就說明這個指標已經處於異常狀態。 比如當資料表空間使用了97%,那麼就可以認為已經異常,資料庫就會產生一條critical alert。

這些資訊在OEM 上都可以很直觀的查看。

 企業管理器(OEM)介紹: Grid Control 和DatabaseControl

 http://blog.csdn.net/tianlesoftware/article/details/5704374

 

Oracle OEM 重建 及 案例 說明

http://blog.csdn.net/tianlesoftware/article/details/4702978

 

Other alertscorrespond to database events such as Snapshot Too Old or Resumable Sessionsuspended. These types of alerts indicate that the event has occurred.

          另一種alerts與db events 相關,如snapshot too old或resumable sessionsuspended。 當發生這些alert時,就會產生對應的alert。

 

In addition tonotification, you can set alerts to perform some action such as running ascript. For instance, scripts that shrink tablespace objects can be useful fora Tablespace Usage warning alert.

 

By default, Oracle Database issues severalalerts, including the following:

--預設情況下,oracle會發布如下的alerts:

(1)    Archive Area Used (warning at80 percent full)

(2)    Broken Job Count and Failed JobCount (warning when goes above 0)

(3)    Current Open Cursors Count(warning when goes above 1200)

(4)    Dump Area Used (warning at 95percent full)

(5)    Session Limit Usage (warning at90 percent, critical at 97 percent)

(6)    Tablespace Space Used (warningat 85 percent full, critical at 97 percent full)

 

You can modify these alerts and others bysetting their metrics.

 這些alerts 和其他的Metrics 值都可以使用DBMS_SERVER_ALERT包的SET_THRESHOLD,GET_THRESHOLD 方法來修改和查看,也可以直接使用OEM來進行修改。

 

與Alerts 相關的資料字典如下表:

 

View

Description

DBA_THRESHOLDS

Lists the threshold settings defined for the instance

DBA_OUTSTANDING_ALERTS

Describes the outstanding alerts in the database

DBA_ALERT_HISTORY

Lists a history of alerts that have been cleared

V$ALERT_TYPES

Provides information such as group and type for each alert

V$METRICNAME

Contains the names, identifiers, and other information about the system metrics

V$METRIC

Contains system-level metric values

V$METRIC_HISTORY

Contains a history of system-level metric values

 

 

小結一下:

 Alert 資訊的產生分兩種: OEM 產生 和 DB Server 產生。

            (1)OEM 是通過EMD(OEMdaemon)直接存取SGA 擷取。

            (2)DB Server 是通過MMON 進程擷取。 Server產生的alert資訊在alert_que中排隊,該隊列的主要consumer是DBCONSOLE。

 

DB Server產生的alerts 有分兩種:基於threshold values 和 event。

(1)基於threshold的alert資訊可以在DBA_OUTSTANDING_ALERTS中。當被clear的時候,會進入DBA_ALERT_HISTORY,而alert history被purge也是基於AWR資訊的purge策略。

(2)基於事件的alert比如下面這些:SnapshotToo Old, ResumableSession Suspended。這部分alert資訊由DBCONSOLE控制,因為DBCONSOLE會把相關資訊存放在自己的repository中。

 

這裡要強調一點MMON 進程,在之前整理的Blog裡有說明:

Oracle 進程 說明

http://blog.csdn.net/tianlesoftware/article/details/6711694

 

The manageabilitymonitor process (MMON) performs many tasks related to the AutomaticWorkload Repository (AWR). For example, MMON writes when a metric violatesits threshold value, taking snapshots, and capturing statistics value forrecently modified SQL objects.

The manageabilitymonitor lite process (MMNL) writes statistics from the Active SessionHistory (ASH) buffer in the SGA to disk. MMNL writes to disk when the ASHbuffer is full.

From: http://docs.oracle.com/cd/E11882_01/server.112/e25789/process.htm#CNCPT89087

 

通過官網上的這段說明,可以很清楚的理解MMON具體的工作:MMONwrites when a metric violates its threshold value, taking snapshots,and capturing statistics value for recently modified SQL objects.

MMON主要執行一些於AWR 相關的任務。如檢查metric,產生快照,捕捉統計資訊. 這裡分Base Statistics和Metrics:

(1)    base statistics是指收集的裸資訊。

(2)    Metrics是基於base statistics的第二層資訊,可以追蹤資料庫的活動變化情況。該統計資訊每分鐘由MMON進程進行更新。METRIC的值由MMON進程計算,儲存在記憶體中一個小時。

 

Metrics每分鐘更新記錄可以通過相關的視圖來確認,這些視圖有:

V$SYSMETRIC,

V$SESSMETRIC,

V$SERVICEMETRIC,

V$METRICNAME

V$FILEMETRIC,

V$EVENTMETRIC,

V$WAITCLASSMETRIC

V$SYSMETRIC_HISTORY,DBA_HIST_*

 

如:

SYS@anqing1(rac1)> alter session setnls_date_format='yyyy-mm-dd hh24:mi:ss';

Session altered.

 

SYS@anqing1(rac1)> selectbegin_time,end_time from V$EVENTMETRIC where rownum=1;

BEGIN_TIME         END_TIME

------------------- -------------------

2011-12-28 01:27:08 2011-12-28 01:28:07

通過以上的查詢,可以確認其時間間隔是每分鐘一次。

 

系統每秒對v$session進行抽樣,放在SGA中的ASH區,該ASH區採用的是迴圈使用的機制,V$ACTIVE_SESSION_HISTORY中包含的是活動會話的資訊。不是所有的ASH資料被寫入磁碟,因為資料量太大,所以進行了過濾。通常每60分鐘(快照預設時間)MMON進程會寫這些資訊,當ASH BUFFER滿的話MMNL進程會寫。

 

            預設情況下AWR快照一個小時收集一次,在Oracle 10g裡,快照儲存7天,11g 保留8天。AWR產生snapshot的頻率和保留原則修改參考:

 

Oracle AWR(AutomaticWorkload Repository) 說明

http://blog.csdn.net/tianlesoftware/article/details/4682300

 

Oracle Statistic 統計資訊 小結

http://blog.csdn.net/tianlesoftware/article/details/4668723

 

 

二. 相關的視圖

 之前整理過一篇根據dba_errors視圖來查看警示的文章:

根據 dba_errors 制定 資料庫警示郵件

http://blog.csdn.net/tianlesoftware/article/details/6433418

 

DBA_ERRORS:describes the current errors on allstored objects in the database.

dba_errors  視圖記錄的是資料庫物件上當前存在的錯誤,這些錯誤資訊包含對象名稱,類型,所有者,錯誤類型和錯誤原因,比如預存程序有語法錯誤,沒有編譯通過,這時就會在dba_errors裡留下記錄。 這裡我們看的是其他的幾個相關視圖。

 

2.1 V$SYSMETRIC_HISTORY

V$SYSMETRIC_HISTORY displaysall system metric values available in the database. Both long duration(60-second with 1 hour history) and short duration (15-second with one-intervalonly) metrics are displayed by this view.

 

Column

Datatype

Description

BEGIN_TIME

DATE

Begin time of the interval

END_TIME

DATE

End time of the interval

INTSIZE_CSEC

NUMBER

Interval size (in hundredths of a second)

GROUP_ID

NUMBER

Metric group ID

METRIC_ID

NUMBER

Metric ID

METRIC_NAME

VARCHAR2(64)

Metric name

VALUE

NUMBER

Metric value

METRIC_UNIT

VARCHAR2(64)

Metric unit description

 

http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3091.htm

 

2.2 DBA_OUTSTANDING_ALERTS

DBA_OUTSTANDING_ALERTS describesalerts which the server considers to be outstanding.

http://docs.oracle.com/cd/E11882_01/server.112/e25513/statviews_4167.htm

           

在Alerts 體系中,基於threshold 的alert 資訊可以通過dba_outstanding_alerts視圖查看,當這個警告被clear 後,資訊會被轉移,那麼該警告資訊可以通過dba_alert_history視圖查看, 該視圖裡的曆史資料也有有限的,其存放周期也受AWR的purge 策略影響。

        比如我們的資料表空間使用率過高,超過了threshold 值,那麼可以通過 DBA_OUTSTANDING_ALERTS查看到,當我們添加資料檔案之後,警告接觸,我們就可以從dba_alert_history視圖裡查看。

 

2.3 DBA_ALERT_HISTORY

DBA_ALERT_HISTORY describesa time-limited history of alerts which are no longer outstanding.

http://docs.oracle.com/cd/E11882_01/server.112/e25513/statviews_3044.htm

 

樣本:

select object_type,reason,creation_time,suggested_action,metric_value from dba_alert_history

 

 

 

 

 

 

 

-------------------------------------------------------------------------------------------------------

著作權,文章允許轉載,但必須以連結方式註明源地址,否則追究法律責任!

Email:             tianlesoftware@gmail.com

Skype:            tianlesoftware

Blog:   http://www.tianlesoftware.com

Weibo:           http://weibo.com/tianlesoftware

Twitter:http://twitter.com/tianlesoftware

Facebook:http://www.facebook.com/tianlesoftware

 

-------加群需要在備忘說明Oracle資料表空間和資料檔案的關係,否則拒絕申請----

DBA1 群:62697716(滿);   DBA2 群:62697977(滿)  DBA3 群:62697850(滿)  

DBA 超級群:63306533(滿);  DBA4 群:83829929   DBA5群: 142216823

DBA6 群:158654907    DBA7 群:172855474  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.