天天看點

oracle手工生成AWR報告方法記錄

1、 運作腳本

首先,準備一個目錄作為AWR生成報告的路徑。

[oracle@bspdev /]$ ls -l | greptest

drwxr-xr-x.  2oracle oinstall 4096 Jun 21 13:01test

[oracle@bspdev /]$ cdtest

[oracle@bspdev test]$ sqlplus/nolog

SQL*Plus: Release11.2.0.1.0 Production onTue Jun 21 13:04:44 2011

Copyright (c) 1982, 2009,Oracle. Allrights reserved.

SQL> conn / as sysdba

Connected.

--調用腳本,生成檔案

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

之後進入報告參數輸入子產品。

2、輸入報告參數

之後,要持續輸入一系列的報告參數。

ü       輸入生成報告類型,目前AWR提供txt和html兩種格式。需要确認生成格式,預設是html格式。

Current Instance

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

  DBId   DBName     InstNum Instance

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

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

Would you like an HTML report, or a plaintext report?

Enter 'html' for an HTMLreport, or 'text' for plain text

Defaults to'html'

ü       報告涉及天數範圍

啟動報告後,會顯示生成執行個體的名稱等基本資訊。

預設情況下,AWR會将鏡像資訊保留一個月。手工生成的時候,需要确認生成AWR報告的時間範圍。一般情況下,特别是生産環境下,我們通常設定1-7天也就夠用了。

Instances in this Workload Repositoryschema

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

  DBId    InstNum DB Name     Instance    Host

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

* 4143510747       1ORA11G      ora11g      bspdev.local

                                               domain

Using 4143510747 for databaseId

Using         1for instance number

Specify the number of days of snapshots tochoose from

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

Entering the number of days (n) will resultin the most recent

(n) days of snapshots beinglisted. Pressingwithout

specifying a number lists all completedsnapshots.

Enter value for num_days:3 

ü       輸入開始和結束的snapshot編号

輸入天數資訊後,AWR生成代碼會将天數範圍内的snapshot鏡像點列出,供輸入選擇。

Listing the last 3 days of CompletedSnapshots

                                                       Snap

Instance    DBName       SnapId   SnapStarted   Level

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

ora11g      ORA11G           178920 Jun 2011 13:01     1

                              179020 Jun 2011 14:00     1

                              179120 Jun 2011 15:00     1

                              179220 Jun 2011 16:00     1

                              (篇幅原因,有省略……)

                              181121 Jun 2011 11:00     1

                              181221 Jun 2011 12:00     1

                              181321 Jun 2011 13:00     1

Specify the Begin and End SnapshotIds

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

之後,我們需要根據列出的時間範圍,輸入開始和結束的snap編号。

Enter value for begin_snap:1796

Begin Snapshot Id specified:1796

Enter value for end_snap:1813 

ü       确定報告名稱

最後就是确定生成報告的名稱。一般采用預設的名稱就可以了。

Specify the Report Name

The default report file name isawrrpt_1_1796_1813.html. To use thisname,

press to continue, otherwise enter analternative.

Enter value forreport_name:

之後輸出内容很多,此處不加以累述。最後提示報告生成成功。

Report written toawrrpt_1_1796_1813.html

于是,指定目錄上可以看到相應的報告檔案。

[oracle@bspdev test]$ ls-l

total 508

-rw-r--r--. 1 oracle oinstall 515262 Jun 2113:10 awrrpt_1_1796_1813.html

3、說明兩個問題

首先,此處生成的html格式的報表。如果要求生成txt格式,就在生成過程中選擇text格式報表。

Specify the Report Type

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

Defaults to 'html'

Enter value for report_type:text

Type Specified: text

End of Report

Report written toawrrpt_1_1789_1800.txt

total 692

-rw-r--r--. 1 oracle oinstall 180601 Jun 2113:27 awrrpt_1_1789_1800.txt

4、結論

手工生成AWR報告,可以避免受到OEM的限制限制,而且靈活度高。本篇記錄,權當備忘。