文档库 最新最全的文档下载
当前位置:文档库 › 数据库性能诊断与优化

数据库性能诊断与优化


数据库性能诊断和调优-最佳实践 数据库性能诊断和调优 最佳实践

主要议题
? 面临的挑战 ? 调优工具的变迁 ? 调优实践 ? Q&A
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司


面临的挑战
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

IT系统面临的挑战 系统面临的挑战
Consistent end-to-end application and service performance guarantees Unplanned infrastructure changes resulting in incidents and downtime Unanticipated infrastructure effects from consolidation & new application projects Misconfiguration of network objects
0% 28% 50% 100% 49% 87%
73%
为满足业务的高效率,高性能要求是目前 系统普遍面临的最棘手问题 为满足业务的高效率,高性能要求是目前IT系统普遍面临的最棘手问题
Source: Forrester Research, Top Five Challenges For Enterprise IT Infrastructure Managers — And How To Resolve Them, Thomas Mendel, March 2005
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司


调优工具的变迁
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Oracle 调优工具
? 朦胧之初(v5)
? Debug code
? 初见端倪(v6)
? Counters/Ratios ? BSTAT/ESTAT ? SQL*Trace
? 有所发展(v7)
? Introduction of Wait Event instrumentation ? Move from counters to timers
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Oracle 调优工具
? 快速进化(8i) - Instance tuning using instance statistics
? 实时收集 ? 宽广的范围 ? STATSPACK
? 逐渐完善(9i) - Session tuning using 10046 SQL traces
? 更精细的收集
? 日趋完美 (10g) – 基于数据库自动化基础的更完美的优化
? 更加广泛而有层次的收集 ? 自动化收集 ? 保留一段时间的历史 ? Built into infrastructure: instrumentation, ASH, AWR, ADDM, EM
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Automatic Workload Repository-10g 自动负载信息库 (AWR)
? 数据库中内置了工作负载和性能统计信息库 ? Oracle 数据库 10g 智能自我管理基础架构的一部分 ? 自动捕获工作负载数据
? 默认情况下,每隔 60 分钟保存一次,或者手动保存 7 天的数据
? 驻留于新引入的 SYSAUX 表空间内 ? 服务器自动管理空间要求
?
? ? ? ?
自动清除旧数据
基本统计,例如物理读取 SQL 统计,例如磁盘读取(每个 sql 语句) 量度,例如,物理读取数量/秒 活动会话历史
? 存储不同类别的数据:
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Active Session History-10g 活动会话历史(ASH)
? Samples active sessions every one second into memory (v$active_session_history) ? Direct access to kernel structures ? Data captured includes:
? ? ? ? ? ? SID SQL ID Program, Module, Action Wait event# Object, File, Block actual wait time (if captured while waiting)
查找数据库的瞬间问题
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Automatic System-Wide Analysis: ADDM
Snapshots in Automatic Workload Repository
Automatic Diagnostic Engine Self-Diagnostic Engine inside DB
High-load SQL
IO / CPU issues
RAC issues
? Automatic Database Diagnostic Monitor (ADDM) ? Automatically provides database-wide performance diagnostic ? Self-diagnostic engine in the database ? RAC aware ? Provides impact and benefit analysis, non problem areas ? Runs proactively out of the box, reactively when required
SQL Advisor
System Resource Advice
Network + DB config Advice
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Basic Performance Tuning Process
? Performance and workload data capture
? System statistics, wait information, SQL Statistics, etc. What types of operations are consuming most time? Which resources is the bottleneck? What is the root cause? How can problem be remediated? If multiple problems identified, which is most critical? Which solution will give me most benefit?
AWR
? Analysis
? ? ? ? ? ?
ADDM
? Problem Resolution
ADDM
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

性能调优工具关联图示
Automatic
Fore-ground
In-memory statistics SGA
MMON
60 mn
ASH
Snapshots Snapshots
ADDM
Alerts
Statspack
DBA ADDM results
AWR
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司


调优实践-工具与方法
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Solutions-调优的几种主要方法 调优的几种主要方法
? ? ? ? Manual & Targeted Performance Analysis(手动的分析调整) Automatic System Analysis(自动的分析调整) Comparative Performance Analysis (比较的分析调整) Application and SQL Tuning (SQL的分析调整)
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Statspack
? Statspack的安装
$ORACLE_HOME/rdbms/admin/spcreate.sql
? 收集统计信息
$ORACLE_HOME/rdbms/admin/statspack.snap
? 自动收集统计信息
$ORACLE_HOME/rdbms/admin/spauto.sql
? 生成报表
$ORACLE_HOME/rdbms/admin/spreport.sql
? 要收集计时信息,设置:
TIMED_STATISTICS = True
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Statspack的输出
首页中的信息: ? 数据库和实例名称 ? 获取快照的时间 ? 当前高速缓存的大小 ? 负载概览 ? 实例效率百分比 ? 前五个等待事件
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Statspack的输出(续)
文档其余部分中的信息: ? 等待事件的完整列表 ? 共享池中SQL语句的信息 ? 实例活动统计 ? 表空间和文件I/O ? 缓冲区统计信息 ? 回退段或还原段统计信息 ? 栓锁活动 ? 字典高速缓存统计信息 ? 库高速缓存统计 ? SGA统计 ? Init.ora参数的启动值
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

Manual Performance Analysis
? The CBS Method (“Click on the Big Stuff method”) ? Shows ASH samples for the selected wait class ? Answers the “who” and “what” of the problem
? Who is slowing up the system? ? What is that person doing?
李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

李轶楠
Ora-600
Mail:ora-600@https://www.wendangku.net/doc/798443347.html,
Msn:leryli@https://www.wendangku.net/doc/798443347.html,
133********
北京酷克时代科技有限公司

相关文档
相关文档 最新文档