溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何手工生成AWR運行期對比報告

發布時間:2021-11-06 17:22:30 來源:億速云 閱讀:206 作者:柒染 欄目:建站服務器

這篇文章將為大家詳細講解有關如何手工生成AWR運行期對比報告,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。

 

AWR(Automatic Workload Repository)報告是Oracle 10g之后推出的重要性能診斷工具。AWR是作為Statspack報告的一種有力延伸。借助AWR,我們可以方便的對Oracle數據庫的特定工作時間段進行性能分析評價,最終達到發現瓶頸調優的目標。

 

作為DBA,手工生成AWR報告是工作基本功之一。筆者在之前的《手工生成AWR報告記錄》(http://space.itpub.net/17203031/viewspace-700471)中,就已經詳細介紹過如何在sqlplus工具下生成AWR報告。

 

1、從AWR到AWR Compare Period Report

 

AWR是一個產品體系,根據定時收集的系統運行數據,我們其實可以做的更多。在現在主流的運維管理和調優過程中,基線baseline的概念是一直貫穿始終。系統運行負載Baseline、關鍵SQL執行計劃Baseline等等,反復出現??傊?,所謂的Baseline,簡單的說就是一套運行負載指標或者執行計劃指標。當你認為系統出現問題的時候,可以將Baseline作為標準進行對比,發現問題所在。進一步的,可以將Baseline作為應急手段,強制使用應對生產(SQL Profile、SPM)。

 

我們一般的調優過程中,也的確需要這樣的小工具。比如:業務高峰期和低谷期,數據庫各方面指標有什么樣顯著的差異?進行調優之后,系統性能指標有何種方式變化?這種時候,生成兩份AWR,看著對比的確是一種方法。但是,Oracle已經為我們提供出AWR Compare Period Report來方便實現這樣的功能。

 

從原理上,AWR Compare Period Report不難理解。Oracle將各個時間snap的性能數據保存在SYSAUX表空間的一系列數據字典表中,只要經過合理的組織,compare report不是一件困難的事情。

 

2、手工生成報告

 

本文是一篇記錄文章,依然采用手工sqlplus的方法生成報告。

 

ü        登錄sqlplus,運行腳本

 

使用sqlplus,登錄入指定系統。

 

 

D:\>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on 星期一 3月 5 09:02:42 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

SQL>(登錄過程略……

 

--調用腳本

SQL> @?/rdbms/admin/awrddrpt.sql

 

 

注意:在sqlplus中,?表示$ORACLE_HOME路徑。指定的awrddrpt.sql腳本,也是確實在客戶端本地SQL執行腳本。如果使用如PL/SQL Developer等開發工具,請指定直接路徑。

 

ü        輸入基本報告類型

 

首先同AWR報告一樣, Compare Period Report也存在TEXT和HTML兩種格式支持。在創建過程中,我們需要進行選定。

 

 

Current Instance

~~~~~~~~~~~~~~~~

 

   DB Id       DB Id    DB Name      Inst Num Inst Num Instance

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

 2351142467  2351142467 NBSTEST             1        1 NBSTEST

 

Specify the Report Type

~~~~~~~~~~~~~~~~~~~~~~~

Would you like an HTML report, or a plain text report?

Enter 'html' for an HTML report, or 'text' for plain text

Defaults to 'html'

輸入 report_type 的值:

 

Type Specified:                  html

 

 

ü        輸入第一對比時間段項目

 

既然要做到對比,首先需要指定一個對比時間范圍。這個過程同一般AWR報告相同,過程不予累述。

 

 

Instances in this Workload Repository schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

   DB Id     Inst Num DB Name      Instance     Host

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

* 2351142467        1 NBSTEST      NBSTEST      P550_05_LC

 

Database Id and Instance Number for the First Pair of Snapshots

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using 2351142467 for Database Id for the first pair of snapshots

Using          1 for Instance Number for the first pair of snapshots

 

 

Specify the number of days of snapshots to choose from

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Entering the number of days (n) will result in the most recent

(n) days of snapshots being listed.  Pressing <return> without

specifying a number lists all completed snapshots.

 

--輸入對比時間范圍

輸入 num_days 的值:  3

 

 

之后,Oracle會列出三天范圍的snap信息。

 

 

Listing the last 3 days of Completed Snapshots

                                                        Snap

Instance     DB Name        Snap Id    Snap Started    Level

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

NBSTEST      NBSTEST          10251 03 3月  2012 00:00     1

                              10252 03 3月  2012 01:00     1

(篇幅原因,省略部分……

                              10305 05 3月  2012 06:00     1

 

                                                        Snap

Instance     DB Name        Snap Id    Snap Started    Level

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

NBSTEST      NBSTEST          10306 05 3月  2012 07:00     1

                              10307 05 3月  2012 08:00     1

                              10308 05 3月  2012 09:00     1

 

 

Specify the First Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

輸入 begin_snap 的值:

 

--指定時間片

Specify the First Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

輸入 begin_snap 的值:  10296

First Begin Snapshot Id specified: 10296

 

輸入 end_snap 的值:  10298

 

 

設定了開始和結束時間snap,作為第一個時間。

 

ü        輸入第二對比時間段項目

 

第二報告時間snap信息基本相同,不予累述。

 

 

Instances in this Workload Repository schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host

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

* 2351142467        1 NBSTEST      NBSTEST      P550_05_LC

 

Database Id and Instance Number for the Second Pair of Snapshots

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using 2351142467 for Database Id for the second pair of snapshots

Using          1 for Instance Number for the second pair of snapshots

 

Specify the number of days of snapshots to choose from

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Entering the number of days (n) will result in the most recent

(n) days of snapshots being listed.  Pressing <return> without

specifying a number lists all completed snapshots.

 

輸入 num_days2 的值:

 

輸入 num_days2 的值:  1

 

Listing the last day's Completed Snapshots

                                                        Snap

Instance     DB Name        Snap Id    Snap Started    Level

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

NBSTEST      NBSTEST          10299 05 3月  2012 00:00     1

 (篇幅原因,省略……

                              10306 05 3月  2012 07:00     1

                              10307 05 3月  2012 08:00     1

                              10308 05 3月  2012 09:00     1

 

 

 

Specify the Second Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

輸入 begin_snap2 的值:

--輸入時間片

 

Specify the Second Pair of Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

輸入 begin_snap2 的值:  10306

Second Begin Snapshot Id specified: 10306

 

輸入 end_snap2 的值:  10308

 

 

ü        指定生成報告名稱,生成報告

 

 

Specify the Report Name

~~~~~~~~~~~~~~~~~~~~~~~

The default report file name is awrdiff_1_10296_1_10306.html  To use this name,

press <return> to continue, otherwise enter an alternative.

 

輸入 report_name 的值: --使用默認名稱,保持為空

Using the report name awrdiff_1_10296_1_10306.html

 

 

<br /><a class="awr" href="#top">Back to Top</a><p />

<p />

</body></html>

Report written to awrdiff_1_10296_1_10306.html

 

 

在目錄上,我們就可以發現我們生成的報告文件。

 

 

3、報告內容粗覽

 

AWR報告不同,Compare Period Report強調對比。在所有的項目中,均以第一個和第二個進行對比,并且列出差異值。這對于我們進行負載對比等操作,有很多好處。

可以方便的讓我們進行性能對比和調優前后對比。

 

4、結論

 

AWR報告以及其衍生產品,是我們進行性能調優、問題發現的重要工具武器。用好這些工具,是我們完成工作、履行責任和前進的重要前提。AWR Compare Period Report在進行基線對比和調優效果對比時,是非常方便的工具。

 

關于如何手工生成AWR運行期對比報告就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

awr
AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女