小さい頃はエラ呼吸

いつのまにやら肺で呼吸をしています。


Oracle 11gでAWRのレポートを取得する方法

f:id:replication:20140618014141p:plain

はじめに

Oracle Database 11gでAWR(自動ワークロード・リポジトリ)のレポートを取得してみました。

Oracle データベース ポケットリファレンス ~Oracle11g/12c対応
若杉 司
技術評論社
売り上げランキング: 95,277

バージョン
  • Oracle Database 11g Release 11.2.0.1.0
AWRのレポートの元となるスナップショットを取得する

AWRのレポートを取得するには、最低でも2つのスナップショットが必要です。スナップショットを採取するには、以下のクエリを実行します。

conn sys/oracle as sysdba
EXECUTE DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT();
AWRのレポートを出力してみる

AWRのレポートを出力するには、以下のクエリを実行します。

@?/rdbms/admin/awrrpt.sql

クエリを実行した後は、出力の方法などを対話形式で聞いてくるので、それに答える形でレポートが出力されます。

レポートの形式は、text形式とhtml形式が選択できます。

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1367387266 ORCL                1 orcl


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に値を入力してください: html

何日さかのぼってレポートを取得するかに答えます。

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に値を入力してください: 1

レポートの対象とするスナップショットIDを指定します。

Listing the last day's Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
orcl         ORCL                80 18 6月  2014 01:08     1
                                 81 18 6月  2014 01:11     1



Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
begin_snapに値を入力してください: 80
Begin Snapshot Id specified: 80

end_snapに値を入力してください: 81

レポートのファイル名を指定します。省略した場合は、スナップショットIDがファイル名になります。

Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_80_81.html.  To use this name,
press <return> to continue, otherwise enter an alternative.

report_nameに値を入力してください: