Oracle Server Tuning Accelerator
David Scott
Intec
Tuning Metaphors
Body / Doctor
Auto / Mechanic
The Right Solution
Fixes the immediate problem
Prevents a recurring problem
Fixes the underlying problem
Is found and implemented quickly
Is cost-effective
Is properly documented
Has measurable ROI
The Main Thing
Is To Keep
The Main Thing
The Main Thing
"It's Slow!" - Triage
Compared to what What is "Normal"
Do you have benchmarks
What has changed in the environment
And when
Are you processing the right data
Which part of the system is slow
most expensive / most used queries
Concentrate effort on items with most business impact.
Basic Approach
Define the business problem
Measure the pain
Identify the problem component
Find the root cause
Investigate and weigh solutions
Fix the problem
Measure the results
Case Study #1 p1
Define the BUSINESS problem
The GUI is too slow; a loss in productivity $$$
Measure the pain
Screen XYZ in the GUI takes 47 seconds
3000 users use this screen at each login
Most other screens are fine
Identify the problem component
Stopwatch timing of XYZ response is 47 seconds
Same SQL query takes 47 seconds
Query identified as culprit
Case Study #1 p2
Find the root cause
Inefficient query
Investigate and weigh solutions
Multiple versions of query compared
Results must match original
Fix the problem
Replace query in Screen XYZ with tuned version
Measure the results
Query returns in 2 seconds
ROI: 3000 users * 45 seconds saved * Avg salary @ $10/hour * 260 business days/year = $97,500
Case Study #2 p1
Define the BUSINESS problem
Processing 40M rows exceeds operational window
Measure the pain
Users cannot begin sessions until 10-11 AM
Cost = 2-3 hours overtime for 2 people per day
Identify the problem component
Main processing routine takes > 4 hours/day
Case Study #2 p2
Find the root cause
UPDATE of records in main table is not appropriate for increased workload (maximum 1200 rows/second)
Investigate and weigh solutions
Used tracing, tkprof, Explain Plan
Fix the problem
Rewrite using partitioned staging tables and
INSERT /*+APPEND */
Measure the results
Average run is var snap number;
SQL> exec :snap := statspack.snap;
SQL> print snap
Automated (every hour on the hour!)
@ /rdbms/admin/spauto.sql
Schedule to capture your workload!
Statspack Content
Level >= 0
General Performance Statistics
Level >= 5
SQL Statement Stats
Level >= 6
SQL Plans and Plan Usage
Level >= 7
Segment Level Stats
Level >= 10
Parent and Child Latches
Statspack: Reports
Full Report: spreport.sql
STATS$SNAPSHOT for snapshot info
SQL Report: sprepsql.sql
STATS$SQL_SUMMARY for hash info
Or just run the reports; the info is displayed!
Statspack Resources
Database Performance Tuning Guide and Reference, Chapter 21
Absolute MUST READ!
Websites
Metalink
http://asktom.oracle.com
http://otn.oracle.com
Book:
Oracle9i High-Performance Tuning with STATSPACK by Don Burleson
The V$ Views
Tons of scripts on the net!
Beware of making decisions based on summary information.
The info is 'live' – and changes…
Interesting views:
V$SQL, V$SQL_TEXT, V$SESSION, V$STAT_NAME, V$SORT_USAGE, V$SESSION_WAIT … and many, many more!
Autotrace
Quick plan explanation & basic statistics
To setup, see http://osi.oracle.com/~tkyte/ article1/autotrace.html
Settings
SET AUTOTRACE ON EXPLAIN
SET AUTOTRACE ON STATISTICS
SET AUTOTRACE ON
SET AUTOTRACE TRACEONLY
Explain Plan
explain plan set statement_id = 'whatever'
for ;
select * from table(dbms_xplan.display);
Are the plans what you expect
Full table scans are not always 'bad'
See Database Performance Tuning Guide and Reference, Chapter 9
SQL Trace
Started in Oracle7
Cryptic but useful information
Files written to UDUMP directory
Level 1 = Equal to SQL_TRACE=TRUE.
Level 4 = SQL_TRACE & bind variables.
Level 8 = SQL_TRACE & wait events.
Level 12 = Combines levels 4 & 8.
Wait Events
Identify where time is spent waiting for work
Viewable in V$SESSION_WAIT
join to V$SESSION
Written to trace file via event 10046
alter session set events
'10046 trace name context forever, level 12';
alter session set events
'10046 trace name context off' ;
exec sys.dbms_system.set_sql_trace_in_session (sid, serial#,TRUE | FALSE);
How to Use Wait Events
Modify the process to set the event
Run the process (or part of it)
Find the trace file
Use tkprof to summarize the trace file
Find the significant statements
Identify the waits
Modify the code and/or environment
Using Tkprof
tkprof inputfile.trc outputfile
Many sorting options
I don't bother… some folks do.
To get help, type 'tkprof' w/o parameters
Avoid tkprof explain=user/pw
Gives current explain plan, not actual plan
Then just vi outputfile
Tkprof Resources
Expert Oracle One-On-One by Tom Kyte
Database Performance Tuning Guide and Reference, Chapter 10
Every performance book ever written…
10g Changes Everything (Almost)
ADDM – Automatic Database Diagnostic Monitor
Statspack, V$, and 'OEM' rolled into 1 place
OEM has been expanded
To be continued…
Are You Finished
CTD – Compulsive Tuning Disorder
Document the solution
Calculate the ROI
- sqlcasewhenthen > /rdbms/admin/spautosql
-
/rdbms/admin/spautosql
下载该文档 文档格式:PPT 更新时间:2005-06-01 下载次数:0 点击次数:2文档基本属性 文档语言: 文档格式: ppt 文档作者: David Scott 关键词: 主题: 备注: 点击这里显示更多文档属性 经理: 单位: Intec Telecom Systems 分类: 创建时间: 上次保存者: David.Scott 修订次数: 27 编辑时间: 文档创建者: 修订: 加密标识: 幻灯片: 36 段落数: 264 字节数: 44543 备注: 0 演示格式: On-screen Show 上次保存时间:
- 下载地址 (推荐使用迅雷下载地址,速度快,支持断点续传)
- PPT格式下载
- 更多文档...
-
上一篇:Transact-SQL程序设计
下一篇:\\D0SERVER4\projects\OnlineComputing\Tutorials\Hdb...
点击查看更多关于sqlcasewhenthen的相关文档
- 您可能感兴趣的
- casewhenthen casewhenthenend casewheninthen sqlcasewhen sqlcasewhennull sqlcasethen sqlsumcasewhen sqlcasewhen嵌套 plsqlcasewhen sqlwhenthen
- 大家在找
-
- · 中国模具资料网
- · 武汉pcb板设计研尚
- · 暖通注册考试2010真题
- · 水浒传第86集高清观看
- · 数字万用表测量可控硅
- · 食品检验工(中级)题库
- · 高端单电相机
- · 宁波求职信息
- · 大学生SYB创业培训课件
- · 《房屋建筑学》教学课件
- · 找不到jar
- · 农村小学德育工作计划
- · imba3.76
- · 2011最新dj网站
- · 2010研究生分数线
- · 职业生涯规划ppt素材
- · 北京大学教育学院
- · autocad2008命令
- · 汽车保养diy
- · 乡村猎艳类小说
- · 摆线液压马达工作动画
- · 建筑工程职称评定论文
- · 管理运筹学论文
- · 活塞式空气压缩机价格
- · 砂带机系列
- · 型葫芦双梁桥式起重机
- · 2007excel下载中文版
- · 电脑怎么升级
- · 魔法咪路咪路
- · 肾病综合症能治好吗
- · 1024x600电脑桌面壁纸
- · 摩托车行驶
- · 脕煤虏芦戮铆脢庐
- · 离心通风机的功能
- · 家庭园林设计图
- · 传感技术学报投
- · 小区绿化设计图
- · 大众媒介研究导论
- · 一年级数学期中考试题
- · 定时提醒器
- 赞助商链接