Oracle Server Tuning Accelerator David Scott Intec.

Slides:



Advertisements
Similar presentations
Using the SQL Access Advisor
Advertisements

Oracle Enterprise Manager Grid Control: Day in the Life of An Admin Wilson N. López – Solution Specialist.
Youre Smarter than a Database Overcoming the optimizers bad cardinality estimates.
Performance Tuning Methods Author: Vladimir Andreev Semantec GmbH Lector: Stoyan Ivanov Semantec Bulgaria OOD Semantec GmbH Benzstr. 32 D Herrenberg,
Why is that LOV in the screen not returning me desired value?
Tuning Oracle SQL The Basics of Efficient SQLThe Basics of Efficient SQL Common Sense Indexing The Optimizer –Making SQL Efficient Finding Problem Queries.
Advanced Oracle DB tuning Performance can be defined in very different ways (OLTP versus DSS) Specific goals and targets must be set => clear recognition.
Introduction to SQL Tuning Brown Bag Three essential concepts.
Performance Tuning Compiled from: Oracle Database Administration, Session 13, Performance, Harvard U Oracle Server Tuning Accelerator, David Scott, Intec.
9 Copyright © 2006, Oracle. All rights reserved. Automatic Performance Management.
SQL Tuning Briefing Null is not equal to null but null is null.
Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
© Bharati Vidyapeeths Institute of Computer Applications and Management, New Delhi © Bharati Vidyapeeths Institute of Computer Applications and.
Database Performance Tuning and Query Optimization
RAC I/O Lab. 1. Run Database Load Script Your instructor will provide you with a directory containing database schema creation and data loading scripts.
IO Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Waits Covered in this Section  db file sequential read  db file scattered.
An introduction to SQL*Trace, TKPROF and Execution Plans
1 Tuning with Oracle’s SQL Trace David Kurtz Go-Faster Consultancy Ltd.
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Performance And Tuning – Lecture 7 Copyright System Managers LLC 2007 all rights reserved.
12 Copyright © 2005, Oracle. All rights reserved. Proactive Maintenance.
Chapter 11 - Monitoring Server Performance1 Ch. 11 – Monitoring Server Performance MIS 431 – created Spring 2006.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 11 Database Performance Tuning and Query Optimization.
10 Copyright © 2009, Oracle. All rights reserved. Managing Undo Data.
Oracle 10g Database Administrator: Implementation and Administration
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
Introduction Optimizing Application Performance with Pinpoint Accuracy What every IT Executive, Administrator & Developer Needs to Know.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 11 Database Performance Tuning and Query Optimization.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
Improving Efficiency of I/O Bound Systems More Memory, Better Caching Newer and Faster Disk Drives Set Object Access (SETOBJACC) Reorganize (RGZPFM) w/
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
11-1 Improve response time of interactive programs. Improve batch throughput. To ensure scalability of applications load vs. performance. Reduce system.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
Oracle tuning: a tutorial Saikat Chakraborty. Introduction In this session we will try to learn how to write optimized SQL statements in Oracle 8i We.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
Troubleshooting 11i issues Adam Janbolat
1 Chapter 13 Parallel SQL. 2 Understanding Parallel SQL Enables a SQL statement to be: – Split into multiple threads – Each thread processed simultaneously.
MISSION CRITICAL COMPUTING Siebel Database Considerations.
Tools for Analyzing Problems in Oracle Applications Jeff Slavitz (415)
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
IMS 4212: Database Implementation 1 Dr. Lawrence West, Management Dept., University of Central Florida Physical Database Implementation—Topics.
Distributed Logging Facility Castor External Operation Workshop, CERN, November 14th 2006 Dennis Waldron CERN / IT.
DB Tuning : Chapter 10. Optimizer Center for E-Business Technology Seoul National University Seoul, Korea 이상근 Intelligent Database Systems Lab School of.
1 Chapter 8 Execution Plan Management. 2 Overview of Execution Plan Management Review techniques to – override optimizer – Improve optimizer’s decisions.
Oracle9i Developer: PL/SQL Programming Chapter 11 Performance Tuning.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
You Inherited a Database Now What?
SQL Trace and TKPROF.
Query Performance Tuning: Start to Finish
SQL Server Monitoring Overview
Database Performance Tuning and Query Optimization
Targeting Wait Statistics with Extended Events
RAC Performance Lab.
You Inherited a Database Now What?
Chapter 11 Database Performance Tuning and Query Optimization
Presentation transcript:

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

Its 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 $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 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 < 2 hours (average 3600 rows/second) –Processing completes before users arrive

Wheres the Wait? Client Application Network Disk CPU Database

Finding Out Whats Wrong Guessing… (from experience, of course) –Old wives tales and Rules of Thumb Trial and Error Statspack Using the V$ Tables –Cache Hit and other ratios –Top SQL (cost, # executions, logical/physical I/O) Explain Plan –Are indexes always good? Are they used? Profiling and Tracing –Autotrace, Event –Wait Events

Investigative Arsenal SQL*Plus Docs –Performance Tuning Guide and Reference Wait event reference –Database Reference Init.ora parameters, V$ view listings Tkprof TOAD, OEM, etc (optional) OS tools: vi, iostat, sar, etc.

Fixing Whats Wrong Change the database configuration: init.ora Statistics –Make better choices, I/O speed is unchanged –Outlines Rewrite –Parallel operations –Hints –More efficient plans Re-architect / Rebuild

Pitfalls Risk: Wasting time chasing a hunch Problem: fixing before finding out! –jumping to conclusions Problem: It cant hurt… –Yes, it can. Problem: Multiple changes at once –Which one fixed it? –Side effects (What else did you break?)

Which Approach, When? Massive problems, entire computer –OS tools, Configuration parameters Entire database is slow, no clues –Statspack, V$ views This query or batch is slow –Autotrace, V$, Tracing, Wait Events

OS Tools Basic observation of resources and processes –top –sar –iostat –ps –ef –ipcs

Configuration Parameters Use AUTO parameters where possible Override only when needed –Have a good reason Remove deprecated parameters Check COMPATIBLE

Parameter Resources Oracle 9i Database Reference Guide, Chapter 1 The usual websites… Oracle Initialization Parameters Pocket Reference by David C. Kreines, OReilly Press

Statspack What is it? How to install it? How to gather data? What is reported? How to report on the data?

Statspack: What is it? System-wide stats and ratios Based on bstat / estat Point-in-time snapshots Automated via DBMS_JOBS Many options and settings

Statspack: Installation Login as a Follow prompts for user, pw, tablespaces Set TIMED_STATISTICS=TRUE Set JOB_QUEUE_PROCESSES=1 or more Total setup time: about 2 minutes!

Statspack: Gather Data Manual –EXEC STATSPACK.SNAP; –Better: SQL> var snap number; SQL> exec :snap := statspack.snap; SQL> print snap Automated (every hour on the hour!) 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 – – 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 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 –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 dont 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