[OracleDB] ASHレポートの出力方法

AWRのASH(Active Session History)レポート取得方法を紹介します。

ASHとはアクティブなセッションの履歴情報です。

履歴情報の中にはDB CPU待機状態(Disk IO/ロック待ち/Network待機/etc…)などが含まれております。

ASHレポートは取得した履歴情報をレポート化してくれますので、

性能問題が発生した際の原因分析に大変便利です。

なおAWR・ASH利用には「Diagnostic Pack」のライセンスが追加で必要になります。

目次

ASHレポートとは?

ASHとは、アクティブ・セッションに関する統計情報を毎秒サンプリングしたの履歴情報です。

AWRレポートがデータベース全体の統計情報に対して、

ASHは特定のSQLを時間ごとに見る化することができます。

例えば100秒かかるSQLが、何秒でParseが終わり、何秒でExecuteして、何秒でFetchしたかという流れを追うことが出来ます。

その際にCPU時間やI/O量、Network転送量も確認することができます。

ASHレポートを取得

ASHレポートの取得方法は、SQL*PlusにSYSユーザでログインし以下のSQLを実行します。

実行した時のカレントディレクトリにレポートが保存されますので注意してください。

@?/rdbms/admin/ashrpti.sql

対話式で取得するレポートの指定をしていきます。

★の部分が対話式で設定値を返していく箇所です。

Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to html
report_typeに値を入力してください: ★</code></pre>
<p>出力したいレポート形式を選択します。 デフォルトでは「HTML形式」になります。</p>
<pre><code class="language-bash">Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DB Id                Inst Num    DB Name Instance Host
---------------- ------------ ----------- --------- ---------------
* 1469414445 1                   ORCL       orcl        rhel73-12201

Defaults to current database
dbidに値を入力してください: ★

DBIDを入力します。 デフォルトはすべてのスナップショットから選択できるようになります。

Enter instance numbers. Enter 'ALL' for all instances in a
RAC cluster or explicitly specify list of instances (e.g., 1,2,3).
Defaults to current instance.
inst_numに値を入力してください: ★

インスタンス番号を指定します。RACの場合はALLを選択します。

ASH Samples in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Oldest ASH sample available:
07-6月 -18 03:00:17 [ 48957
mins in the past]
Latest ASH sample available:
11-7月 -18 02:57:12 [ 0
mins in the past]

Specify the timeframe to generate the ASH report
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter begin time for report:

-- Valid input formats:
-- To specify absolute begin time:
-- [MM/DD[/YY]] HH24:MI[:SS]
-- Examples: 02/23/03 14:30:15
-- 02/23 14:30:15
-- 14:30:15
-- 14:30
-- To specify relative begin time: (start with '-' sign)
-- -[HH24:]MI
-- Examples: -1:15 (SYSDATE - 1 Hr 15 Mins)
-- -25 (SYSDATE - 25 Mins)

Defaults to -15 mins
begin_timeに値を入力してください: ★

ASHのサンプルリング開始時刻を指定します。

デフォルトでは15分前を指定します。

Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Press Enter to analyze till current time
durationに値を入力してください:
Report duration specified: ★

ASHのサンプルリング終了時刻を指定します。

デフォルトでは現在時刻を指定します。

Specify Slot Width (using ashrpti.sql) for 'Activity Over Time' section
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- Explanation:
-- In the 'Activity Over Time' section of the ASH report,
-- the analysis period is divided into smaller slots
-- and top wait events are reported in each of those slots.

-- Default:
-- The analysis period will be automatically split upto 10 slots
-- complying to a minimum slot width of
-- 1 minute, if the source is V$ACTIVE_SESSION_HISTORY or
-- 5 minutes, if the source is AWR_(PDB/ROOT)_ACTIVE_SESS_HISTORY.

Specify Slot Width in seconds to use in the 'Activity Over Time' section:
Defaults to a value as explained above:
slot_widthに値を入力してください: ★

時間帯(秒数)」を指定します。

Specify SESSION_ID (eg: from V$SESSION.SID) report target:
Defaults to NULL:
target_session_idに値を入力してください:
SESSION report target specified: ★

セッションID(SESSION_ID )」を指定します。V$SESSIONビューのSID列を確認できます。

Specify SQL_ID (eg: from V$SQL.SQL_ID) report target:
Defaults to NULL: (% and _ wildcards allowed)
target_sql_idに値を入力してください:
SQL report target specified: ★

SQL ID」を指定します。V$SQLビューのSQL_ID列で確認できます。

Specify WAIT_CLASS name (eg: from V$EVENT_NAME.WAIT_CLASS) report target:
[Enter 'CPU' to investigate CPU usage]
Defaults to NULL: (% and _ wildcards allowed)
target_wait_classに値を入力してください: ★

WAIT_CLASS」を指定します。V$EVENT_NAMEビューのWAIT_CLASS列で確認できます。

Specify SERVICE_HASH (eg: from V$ACTIVE_SERVICES.NAME_HASH) report target:
Defaults to NULL:
target_service_hashに値を入力してください: ★

SERVICE_HASH」を指定します。V$ACTIVE_SERVICESビューのNAME_HASH列で確認できます。

Specify MODULE name (eg: from V$SESSION.MODULE) report target:
Defaults to NULL: (% and _ wildcards allowed)
target_module_nameに値を入力してください: ★

MODULE」を指定します。V$SESSIONビューのMODULE列で確認できます。

Specify ACTION name (eg: from V$SESSION.ACTION) report target:
Defaults to NULL: (% and _ wildcards allowed)
target_action_nameに値を入力してください: ★

ACTION」を指定します。V$SESSIONビューのACTION列で確認できます。

Specify CLIENT_ID (eg: from V$SESSION.CLIENT_IDENTIFIER) report target:
Defaults to NULL: (% and _ wildcards allowed)
target_client_idに値を入力してください: ★

CLIENT_ID」を指定します。V$SESSIONビューのCLIENT_IDENTIFIER列で確認できます。

Specify PLSQL_ENTRY name (eg: "SYS.DBMS_LOB.*") report target:
Defaults to NULL: (% and _ wildcards allowed)
target_plsql_entryに値を入力してください: ★

対象の「PLSQL」を指定します。

Specify CONTAINER name (eg: NAME from V$PDBS) report target:
Defaults to NULL: (% and _ wildcards allowed)
target_containerに値を入力してください: ★

コンテナ名(CONTAINER)」を指定します。

Specify CONTAINER name (eg: NAME from V$PDBS) report target:
Defaults to NULL: (% and _ wildcards allowed)
target_containerに値を入力してください: ★

レポート名を指定します。

レポート名にディレクトリを指定しないとカレントディレクトリにレポートが生成されますので注意してください。

よかったらシェアしてね!
  • URLをコピーしました!
目次