没有合适的资源?快使用搜索试试~ 我知道了~
首页ORACLE性能优化工具整理
资源详情
资源推荐
目录
ORACLE 性能调整工具:AWR、ASH、ADDM„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„1
基本概要„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„2
注意事项„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„3
1. AWR(Automatic Workload Repository )„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„4
1.1 官网介绍„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„5
1.2 拓扑图„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„6
1.3 收集来源、方案、级别„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„7
1.3.1 收集来源 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„8
1.3.1.1 AWR 数据提取 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„9
1.3.1.2 收集信息的视图含义„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„10
1.3.2 收集级别参数„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„11
1.3.3 收集方案„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„12
1.4 AWR 报告详情 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„13
1.4.1Instance 信息„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„14
1.4.2 系统信息„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„15
1.4.3 快照信息„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„16
1.4.4 SGA 区域大小„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„17
1.4.5 库状态 Load profile „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„18
1.4.6 实例操作命中率„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„19
1.4.7 Shared Pool 解析比情况„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„20
1.4.8 TOP 5 事件„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„21
1.4.8.1 LOG 问题处理„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„22
1.4.8.1.1 问题分析„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„23
1.4.8.1.2 问题校验„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„24
1.4.8.1.3 问题确定„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„25
1.4.8.1.4 解决方案„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„26
1.4.8.1.4.1 官方 LOG 大小建议„„„„„„„„„„„„„„„„„„„„„„„„„„„„„27
1.4.8.1.4.2 实践增加 LOG 步骤„„„„„„„„„„„„„„„„„„„„„„„„„„„„„28
1.4.8.1.4.2.1 查看 redo log 组状态„„„„„„„„„„„„„„„„„„„„„„„„30
1.4.8.1.4.2.2 查看 redo log 组成员„„„„„„„„„„„„„„„„„„„„„„„„31
1.4.8.1.4.2.3 增加 redo log 组„„„„„„„„„„„„„„„„„„„„„„„„„„32
1.4.8.1.4.3 校验增加情况„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„33
1.4.8.1.4.4 删除原日志组成员„„„„„„„„„„„„„„„„„„„„„„„„„„„„„34
1.4.8.1.4.5 性能查看„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„35
1.4.9 内存与物理内存统计信息„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„36
1.4.10 SQL statistios „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„37
1.4.11 Time Model Statisitios „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„38
1.4.12 系统统计部分 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„39
1.4.13 分析 IO Stats „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„40
1.4.14 Buffer Pool Advisory „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„41
1.4.15 PGA Memory Advisory„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„42
1.4.16 Shared Pool Advisory „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„43
1.4.17 SGA Target Advisory„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„44
1.5 调整 AWR 配置„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„45
1.5.1 官网:Modifying Snapshot Settings „„„„„„„„„„„„„„„„„„„„„„„„„„„„46
1.6 其他„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„47
1.6.1 RAC 环境中的 AWR „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„48
1.7 AWR 相关问题 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„49
1.7.1 AWR 报告乱码??问题 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„50
1.7.1.1 分析 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„51
1.7.1.2 更改命令 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„52
1.7.1.3 效果 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„53
1.7.2 截取长度问题 ORA-06512 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„54
1.7.2.1 错误详情 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„55
1.7.2.2 方案 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„56
2. ASH(Active Session History)„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„57
2.1 官网介绍„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„58
2.2 拓扑图„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„59
2.3 简单总结„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„60
2.4 体系结构„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„61
2.5 报告详情„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„62
2.6 工作原理„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„63
2.7 视图含义„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„64
2.7.2 V$ACTIVE_SESSION_HISTORY„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„65
3. ADDM (Automatic Database Diagnostic Monitor)„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„66
3.1 官网介绍„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„67
3.2 内容介绍„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„68
3.3 ADDM 具体报告 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„69
4. 其他 „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„70
4.1 获取 sql 的执行计划„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„71
4.1.1 脚本„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„72
4.1.2 包„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„73
4.1.3 SQL „„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„„74
Oracle 性能调整工具--AWR、ASH、ADDM
基本概要
(避免会话断开,v$session,v$Session_wait 信息会删除)10g 中新出现了 v$session_wait_history 视图保存每个活动 session
在 v$session_wait 中最近 10 次等待事件. 但这远远不够对于数据性能状况监测的,所以后添加了一个视图:
v$active_session_history。这就是 ASH。
Active Session History (ASH):以每隔 1 秒钟将当前活动的 session 的信息记录在 SGA 的一个缓冲区(循环使用)中,采样间
隔时间由 _ash_sampling_interval 参数确定。(采样调用后台进程:MMNL)而内存记录数据有限而且数据库重启(v$动态性能
视图将重新初始化)所有的 ASH 信息都会消失,为保存历史数据,引入了自动负载信息库(Automatic Workload Repository (AWR
调用后台进程:MMON))在 ASH 信息写满后会调用 MMON 将采集信息写出到 AWR 负载库中,不接受 ASH 全部写,一般只写入收集的
10%的数据量,(v$active_session_history 通过 MMON,MMNL 后台进程默认 ASH Buffers 中采 样一次数据定期(每小时 1 次)地被
刷新到 AWR 负载库中,且保留一周来分析) 写是使用 direct-path insert 完成,尽量减少日志的生成,从而最小化数据库性能
影响。
ADDM (Automatic Database Diagnostic Monitor AWR)(自动化诊断工具 )
The Automatic Database Diagnostic Monitor (ADDM) analyzes data in the Automatic Workload Repository (AWR) to identify
potential performance bottlenecks.
ADDM:Oracle 内部的一个顾问系统, 能够自动的完成数据库的一些优化建议(awr 快照信息给予诊断),给出 SQL 的优化,索引
的创建,统计量的收集等建议。
sql tuning advisor 单纯的考虑 sql 语句 不考虑对象/负载; sql access advisor 全面的考虑 sql 对象负载情况
注意事项
1)awr 保留时间:(10g - -7 天,11g - - 8 天 SQL> select snap_interval,retention from dba_hist_wr_control;)
mmon 后台进程会以每 30 分钟自动负责收集和清理 awr 自动负载仓库数据一次,7 或 8 天之前的 snapshot,而和
sysaux 表空间使用率没有关系!
2)如想在 10:00--->10:30 期间也生成一次报告 只需在 10:30 时只需手动创建快照
SQL> exec dbms_workload_repository.create_snapshot;
再 awr 看下会生成 10:30 的快照 ID
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
sinodb SINODB 1135 20 Aug 2013 10:00 1
1136 20 Aug 2013 10:30 1
3)snap ID 1135、 1136 要联系且期间不能 shutdown
原因: 重启 v$动态性能视图将重新初始化
ORA-20200: The instance was shutdown between snapshots 1135 and 1136
看库中多少个动态性能视图:SELECT * FROM V$FIXED_TABLE c where c.TYPE='VIEW';(USER$以$结尾的是数据库自带
的字典表)
AWR(Automatic Workload Repository )
官网介绍
AWR:(Oracle Database 10g new tools)
Automatic Workload Repository (AWR). A built-in repository in every Oracle database(a repository of historical
performance data that includes cumulative statistics for the system, sessions, individual SQL statements, segments,
and services. These statistics are the foundation of performance tuning. By automating the gathering of database
statistics for problem detection and tuning). Oracle Database periodically makes a snapshot of its vital statistics
and workload information and stores them in AWR;AWR serves as the foundation for database self-management.(you
can fast-speed diagnose problems and To solve the bottleneck)
The database stores recent AWR statistics in the SGA. By default, the MMON process gathers statistics every hour
and creates an AWR snapshot,A snapshot is a set of performance statistics captured at a specific time. The database
writes snapshots to the SYSAUX tablespace. AWR manages snapshot space, purging older snapshots according to a
configurable snapshot retention policy.(default keep 7 days)
An AWR baseline: 默认永久保存,手动执行 drop_baseline()删除基线 is a collection of statistic rates usually taken
over a period when the system is performing well at peak load. You can specify a pair or range of AWR snapshots
as a baseline. By using an AWR report to compare statistics captured during a period of bad performance to a baseline,
you can diagnose problems. An automated maintenance infrastructure known as AutoTask illustrates how Oracle Database
uses AWR for self-management. By analyzing AWR data, AutoTask can determine the need for maintenance tasks and
schedule them to run in Oracle Scheduler maintenance windows. Examples of tasks include gathering statistics for
the optimizer and running the Automatic Segment Advisor.
拓扑图 (topological graph)
1. MMON 默认每隔 60 分钟 (可以调整) 将 ash buffers 中的数据的 1/10 flush 到磁盘 ,采集的数据保留时间(7 天)。
查看: select * from dba_hist_wr_control;
例如: 修改为收集快照频率 20 分钟,保留数据 2 天:
begin
dbms_workload_repository.modify_snapshot_settings(interval=> 20,
retention => 2 * 24 * 60);
end;
2. MMNL 默认当 ash buffers 满 66% 的时候将 ash buffers 中的 1/10 的数据写入磁盘 (具体 1/10 是哪些数据,遵循 FIFO
原则)
3. MMNL 写入的采用数据百分比 10% 表示的是写入磁盘的数据占 ash buffers 中采样数据量的百分比 (而不是占 ash
buffers 总大小的比例)
收集来源、方案、级别
收集来源
AWR 用的多个表来存储采集的性能统计数据,表都存储在 SYSAUX 表空间中 SYS 用户下,并且以 WRM$_*和 WRH$_*,WRI$_*, WRR$_*
的格式命名。AWR 的历史数据主要存储在基础表 wrh$_active_session_history(分区表).
WRM$_*
类型存储 AWR 的元数据信息(如检查的数据库和采集的快照),M 代表 metadata(awrinfo.sql 脚本)
WRH$_*
类型保存采样快照的历史统计数据。H 代表“历史数据” (awrrpt.sql 脚本)
WRI$_*
类型表示存储数据库建议功能(advisor)相关的数据 (ADDM 相关数据)
WRR$_*
代表的是 11g 新功能 Workload Capture 以及 Workload Replay 相关信息
在这些表上构建了几种带前缀 DBA_HIST_ 的视图,这些视图可以用来编写您自己的性能诊断工具。视图的名称直接与表相关;
例如,视图 DBA_HIST_SYSMETRIC_SUMMARY 是在 WRH$_SYSMETRIC_SUMMARY 表上构建的。
注意:
ASH 保存了系统最新的处于等待的会话记录,可以用来诊断数据库的当前状态;而 AWR 中的信息最长可能有 1 小时的延迟(虽然
可以手工调整),所以其采样信息并不能用于诊断数据库的当前状态,但可以用来作为一段时期内数据库性能调整的参考。
AWR 数据提取
其实 AWR 记录的信息不仅是 ASH,还可以收集到数据库运行的各方面统计信息和等待信息,用以诊断分析。
AWR 的采样方式是,以固定的时间间隔为其所有重要的统计信息和负载信息执行一次采样,
并将采样信息保存在 AWR 中。可以这样说:ASH 中的信息被保存到了 AWR 中的视图 wrh$_active_session_history 中。ASH 是 AWR
的真子集。
这些采样数据都存储在 SYSAUX 表空间中, 当 SYSAUX 表空间满后,AWR 将自动覆盖掉旧的信息,并在警告日志中记录一条相关信
息:
ORA-1688: unable to extend table SYS.WRH$_ACTIVE_SESSION_HISTORY partition WRH$_ACTIVE_3533490838_1522 by 128 in
tablespace SYSAUX(在 alert log 中) 通过修改 interval 参数可以修改 awr 信息的采样频率。最小的值是 10 分钟,默认的是
60 分钟.典型的值是 10,20,30,60,120 等等。把 interval 设为 0 则关闭自动捕捉快照.如将收集间隔时间改为 30 分钟一次。并
且保留 5 天时间(注:单位都是为分钟).
收集信息的视图含义
Tables that AWR uses to collect statistics
v$sys_time_model
time model stats (db time, java execution time, pl/sql execution time, etc)
v$osstat
operating system stats (avg_busy_ticks, avg_idle_ticks, etc)
v$service_stats
wait statistics ( db cpu, app wait time, user commits, etc)
v$sysstat
system stats
v$sesstat
session stats
ctive
alter system set statistics_level = typical;
alter system set statistics_level = all;
De-active
alter system set statistics_level = basic;
剩余33页未读,继续阅读
TomHu_SC
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功