1.以oracle用戶登錄oracle數據庫,執行如下命令登錄數據庫:
sqlplus / as sysdba
2.運行如下命令:
@?/rdbms/admin/awrrpt.sql
3.出現如下信息時,直接回車(默認HTML格式)
Would you like an HTML report, or a plain text report?
4.出現如下信息時,直接回車
Enter value for num_days:
控制檯上打印出一系列類似如下的信息:
Snap Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
ora11g ORA11G 1789 20 Jun 2011 13:01 1
1790 20 Jun 2011 14:00 1
5.出現如下信息時,從上面的列表中根據實際需要選擇AWR報告的起始時間點選擇對應的Snap Id,輸入進去,並回車;
Enter value for begin_snap:
6.出現如下信息時,從上面的列表中根據實際需要選擇AWR報告的結束時間點選擇對應的Snap Id,輸入進去,並回車;
Enter value for end_snap:
7.出現如下信息時,直接回車(使用默認生成的文件名,如awrrpt_1_1796_1813.html)
Enter value for report_name:
8.打開生成好的AWR報告,進行分析
AWR報告內容很多,我一般只看下面這一項,基本上有問題的SQL就會出現在這個表格裏了
SQL ordered by CPU Time
參考資料:
http://blog.itpub.net/17203031/viewspace-700471/
http://www.cnblogs.com/lanzi/archive/2011/03/07/1975096.html
http://blog.csdn.net/songyang_oracle/article/details/6558503