如何看懂Oracle数据AWR报告.doc
《如何看懂Oracle数据AWR报告.doc》由会员分享,可在线阅读,更多相关《如何看懂Oracle数据AWR报告.doc(110页珍藏版)》请在三一文库上搜索。
1、如何看懂Oracle数据库AWR报告Oracle优化经验总结李申章2014/3/22本来来源于互联网,实际的系统性能优化工作,进行归纳整理,提炼介绍如何学习看懂Oracle数据库AWR报告,作为经验分享,特编写此文。目录一、AWR报告介绍01.AWR使用02.AWR操作1(1)查看当前的AWR保存策略1(2)调整AWR配置23.AWR名词术语3(1)SQL ordered by Elapsed Time3(2)SQL ordered by CPU Time4(3)SQL ordered by Gets4(4)SQL ordered by Reads4(5)SQL ordered by Exec
2、utions:4(6)SQL ordered by Parse Calls4(7)SQL ordered by Sharable Memory4(8)SQL ordered by Version Count4(9)SQL ordered by Cluster Wait Time4二、WORKLOAD REPOSITORY report for5三、Report Summary51.Cache Sizes52.Load Profile6(1)Oracle的硬解析和软解析73.Instance Efficiency Percentages (Target 100%)84.Shared Pool S
3、tatistics105.Top 5 Timed Events11四、RAC Statistics121.Global Cache Load Profile122.Global Cache Efficiency Percentages (Target local+remote 100%)123.Global Cache and Enqueue Services - Workload Characteristics124.Global Cache and Enqueue Services - Messaging Statistics13五、Main Report13六、More RAC Stat
4、istics13七、Wait Events Statistics131.等待事件介绍14(1)db file scattered read 文件分散读取14(2)db file sequential read 文件顺序读取14(3)buffer busy wait 缓冲区忙15(4)常见的等待事件和解决方法252.Time Model Statistics263.Wait Class 等待事件的类型274.Wait Events非空闲等待事件27(1)查询所有等待事件及其属性:27(2)查询Oracle 10gR1提供的12个等待事件类:285.Background Wait Events空闲
5、等待事件326.Operating System Statistics347.Service Statistics358.Service Wait Class Stats359.SQL Statistics35(1)SQL ordered by Elapsed Time36(2)SQL ordered by CPU Time37(3)SQL ordered by Gets37(4)SQL ordered by Reads39(5)SQL ordered by Executions40(6)SQL ordered by Parse Calls41(7)SQL ordered by Sharabl
6、e Memory42(8)SQL ordered by Version Count43(9)SQL ordered by Cluster Wait Time43(10)Complete List of SQL Text4510.Instance Activity Statistics48(1)Instance Activity Stats48(2)Instance Activity Stats - Absolute Values54(3)Instance Activity Stats - Thread Activity5411.IO Stats54(1)Tablespace IO Stats5
7、5(2)File IO Stats55(3)Buffer Pool Statistics5612.Advisory Statistics56(1)Instance Recovery Stats56(2)Buffer Pool Advisory57(3)PGA Aggr Summary57(4)PGA Aggr Target Stats57(5)PGA Aggr Target Histogram58(6)PGA Memory Advisory58(7)Shared Pool Advisory59(8)SGA Target Advisory59(9)Streams Pool Advisory59(
8、10)Java Pool Advisory59(11)Wait Statistics59(12)Buffer Wait Statistics60(13)Enqueue Activity6013.Undo Statistics60(1)Segment Summary61(2)Undo Segment Stats6114.Latch Statistics62(1)Latch Activity65(2)Latch Sleep Breakdown69(3)Latch Miss Sources69(4)Parent Latch Statistics69(5)Child Latch Statistics7
9、015.Segment Statistics70(1)Segments by Logical Reads70(2)Segments by Physical Reads70(3)Segments by Row Lock Waits71(4)Segments by ITL Waits71(5)Segments by Buffer Busy Waits71(6)Segments by Global Cache Buffer Busy71(7)Segments by CR Blocks Received71(8)Segments by Current Blocks Received7116.Dicti
10、onary Cache Statistics72(1)Dictionary Cache Stats72(2)Dictionary Cache Stats (RAC)7317.Library Cache Statistics73(1)Library Cache Activity73(2)Library Cache Activity (RAC)7318.Memory Statistics74(1)Process Memory Summary74(2)SGA Memory Summary74(3)SGA breakdown difference7519.Streams Statistics75(1)
11、Streams CPU/IO Usage76(2)Streams Capture76(3)Streams Apply76(4)Buffered Queues76(5)Buffered Subscribers76(6)Rule Set7620.Resource Limit Stats7621.init.ora Parameters76八、More RAC Statistics771.Global Enqueue Statistics772.Global CR Served Stats793.Global CURRENT Served Stats794.Global Cache Transfer
12、Stats80一、 AWR报告介绍Oracle 10g之前对数据库做性能检测使用Statspack工具。Oracle Database 10g提供了一个显著改进的工具:自动工作负载信息库(AWR:Automatic Workload Repository)。Oracle建议用户用这个取代Statspack。AWR实质上是一个Oracle 的内置工具,它采集与性能相关的统计数据,并从那些统计数据中导出性能量度,以跟踪潜在的问题。与Statspack不同,快照由一个称为MMON的新的后台进程默认自动地每小时采集一次。为了节省空间,采集的数据在7天后自动清除。快照频率和保留时间都可以由用户修改。AW
13、R是通过对比两次快照(Snapshot)收集到的统计信息,来生成报表数据,生成的报表包括多个部分。它产生两种类型的输出:文本格式(类似于Statspack报表的文本格式但来自于AWR信息库)和默认的HTML格式(拥有到部分和子部分的所有超链接),从而提供了非常用户友好的报表。 AWR使用几个表来存储采集的统计数据,所有的表都存储在新的名称为 SYSAUX的特定表空间中的SYS模式下,并且以WRM$_*和WRH$_*的格式命名。前一种类型存储元数据信息(如检查的数据库和采集的快照),后一种类型保存实际采集的统计数据。H代表“历史数据(historical)”而M代表“元数据 (Metadata)
14、在这些表上构建了几种带前缀DBA_HIST_的视图,这些视图可以用来编写您自己的性能诊断工具。视图的名称直接与表相关;例如,视图DBA_HIST_SYSMETRIC_SUMMARY是在WRH$_SYSMETRIC_SUMMARY 表上构建的。 1. AWR使用 获取Oracle数据库的AWR报告,有很多种方法,可以利用专业的Oracle开发管理工具,如Toad、PLSQL等工具软件。也可以使用Oracle自带的Sqlplus命令行管理。个人则更喜欢Sqlplus命令行管理工具,理由是不受操作系统、应用程序的限制,简单易用。SQL?/rdbms/admin/awrrpt.sql 执行上述SQ
15、L语句命令,获取AWR报告的交互界面如下: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 输入 report_type 的值: Type Specified: html Specify the number of days of snapshots to choose from Entering the number of days (n) wi
16、ll result in the most recent (n) days of snapshots being listed. Pressing without specifying a number lists all completed snapshots. 输入 num_days 的值: 1 Listing the last days Completed Snapshots Snap Instance DB Name Snap Id Snap Started Level - - - - - orcl10g ORCL10G 142 03 7月 2009 08:11 1 143 03 7月
17、 2009 09:00 1 144 03 7月 2009 10:00 1 145 03 7月 2009 11:00 1 146 03 7月 2009 12:01 1 Specify the Begin and End Snapshot Ids 输入 begin_snap 的值: 142 Begin Snapshot Id specified: 142 输入 end_snap 的值: 146 End Snapshot Id specified: 146 Specify the Report Name The default report file name is awrrpt_1_142_146
18、html. To use this name, press to continue, otherwise enter an alternative. 输入 report_name 的值: D:awrrpt_1_142_146.html Report written to D:awrrpt_1_142_146.html上述介绍的是最简单的使用方式,对于数据库优化、运维管理来说,每次按照上述方式,比较耗费时间和力气,如果熟悉操作系统批处理命令、及Oracle的PLSQL语言开发,那么就可以对上述使用方式稍加修改,就能够按照特定的需求自东导出AWR报告。在运维管理的过程中,曾按照特定的需求,对做了
19、相应的完善,得到了很好的应用效果,这里不做详述,如果感兴趣,欢迎交流经验。2. AWR操作 (1) 查看当前的AWR保存策略 SQL col snap_interval format a20 SQL col retention format a20 SQL select * from dba_hist_wr_control; DBID SNAP_INTERVAL RETENTION TOPNSQL - - - - 262089084 +00000 01:00:00.0 +00007 00:00:00.0 DEFAULT以上结果表示:每小时产生一个SNAPSHOT,保留7天。 (2) 调整AWR
20、配置 AWR配置都是通过dbms_workload_repository包进行配置。 调整AWR产生snapshot的频率和保留策略,如将收集间隔时间改为30 分钟一次。并且保留5天时间(单位都是分钟):SQLexec dbms_workload_repository.modify_snapshot_settings(interval=30, retention=5*24*60); 关闭AWR,把interval设为0则关闭自动捕捉快照 :SQL exec dbms_workload_repository.modify_snapshot_settings(interval=0); 手工创建一个
21、快照 SQL exec dbms_workload_repository.create_snapshot(); 查看快照 SQL select * from sys.wrh$_active_session_history; 手工删除指定范围的快照 SQL exec dbms_workload_repository.drop_snapshot_range(low_snap_id = 973, high_snap_id = 999, dbid = 262089084); 创建Baseline,保存这些数据用于将来分析和比较 SQL exec dbms_workload_repository.cre
22、ate_baseline(start_snap_id = 1003, end_snap_id = 1013, apply_interest_1); 删除Baseline SQL exec dbms_workload_repository.drop_baseline(baseline_name = apply_interest_1, cascade = false); 将AWR数据导出并迁移到其它数据库以便于以后分析 SQL exec DBMS_SWRF_INTERNAL.AWR_EXTRACT(dmpfile = awr_data.dmp, mpdir = DIR_BDUMP, bid = 1
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 如何 看懂 Oracle 数据 AWR 报告
