oracle 收集AWR报告
AWR(Automatic Workload Repository) 常常用来帮助分析数据库潜在的性能问题。开发测试环境上收集AWR报错简单的可以按照以下4个步骤进行。
步骤一、生成快照
性能测试之前,收集数据库当前的信息,以便在性能测试过程中或结束后进行对比。
|
SQL>conn / as sysdba Connected. SQL>exec dbms_workload_responsitory.create_snapshot; PL/SQL procedure successfully completed. SQL> |
步骤二、进行性能测试
此过程中对数据库产生压力。
步骤三、生产快照
方法同步骤一。收集数据库当前的信息,以便在于步骤一中的数据进行对比。
|
SQL>conn / as sysdba Connected. SQL>exec dbms_workload_responsitory.create_snapshot; PL/SQL procedure successfully completed. SQL> |
步骤四、生产报告
数据库通过对比两次快照之间的差异输出期间数据库的各种统计数据。
|
SQL>@?/rdbms/admin/awrrpt.sql [会被解析为$ORACLE_HOME]
Current Instance ~~~~~~~~~~~~~~~~~~ DB id DB Name Inst Num Instance 588460999 PTLDB 1 ptldb
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' Enter value for report_type: [这里直接回车,输出默认的HTML文件]
Specify the number of days of snapsshots 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.
Enter value for num_days:1 [系统列出1天内的报告列表]
Enter value for num_days:1
Listing the last day's Completed Snapshots
Instance DB Name Snap Id Snap Started Snap Level ptldb PTLDB 7236 28 Dec 2010 00:00 1 7258 28 Dec 2010 21:25 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap:7236[输入起始的快照,性能测试之前产生的] Enter value for end_snap:7258[输入结束的快照,性能测试之后产生的]
Specify the Report Name ~~~~~~~~~~~~~~~~~~~ The default report file name is awrrpt_1_7236_7258.html. To use this name, press <return>to continue,otherwise enter an alternative.
Enter value fro report_name:/home/oracle/awrrpt_1_7236_7258.html [输入报告文件名] <p/> End of Report </body></html> Report written to /home/oracle/awrrt_1_7236_7258.html SQL>
|

浙公网安备 33010602011771号