艾晏 11:23:13
@?dbms/admin/什么什么.sql
想有个家 11:23:45
awrrpt.sql
这个SQL可以测试一个系统中所有的sql的机器消耗情况
生成Oracle Awrrpt报告
ORACLE数据库两个比较重要的问题查看报告:awrrpt.sql,ashrpt.sql
生成报告的脚本一般存放在如下路径:
/u01/app/oracle/product/10.2.0/db**/rdbms/admin
此报告对于查ORACLE数据库的性能非常有帮助,可以追踪数据库的性能问题是出在那个地方
第一步:选择报告输出的文件类型
SQL> @/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/awrrpt.sql
Current Instance ~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance ----------- ------------ -------- ------------ 75258680 HS2008 1 HS2008
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 |
红色字体为生成报告时输出的文件格式此处选择html为例
第二步:报告的时间范围选择
Enter value for report_type: html
Type Specified: html
Instances in this Workload Repository schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host ------------ -------- ------------ ------------ ------------ * 75258680 1 HS2008 HS2008 LinuxRedHat
Using 75258680 for database Id Using 1 for instance number 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.
Enter value for num_days:1 |
红色字体处输入想获取快照的时间段(以天为单位),此处以获取一天为例
第三步:选择获取报告的快照范围
Enter value for num_days: 1
Listing the last day's Completed Snapshots Snap Instance DB Name Snap Id Snap Started Level ------------ ------------ --------- ------------------ ----- HS2008 HS2008 2189 03 9月 2010 14:29 1 2190 03 9月 2010 14:40 1
Specify the Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap: 2189 Begin Snapshot Id specified: 2189
Enter value for end_snap: 2190 |
此处由于本机虚拟机这天刚开没有任何操作所以没什么快照,快照编号必须输入开始和结束的号段以获取这个范围内快照的报告
第四步:输入快照的名字
快照的名字根据自己的需要可以随便起,输入名字回车就会自动生成HTML格式报告;
快照生成后默认的目录是放在/u01/app/oracle/product/10.2.0/db**/rdbms/admin
目录中,如假设名字为20100903.html那么在此目录下会生成一个20100903.html文件报告,只要从这个目录下将此报告取出来就可以用浏览器打开了。