You are on page 1of 29

Oracle Tuning

Ashok Kapur
Hawkeye Technology, Inc.
Agenda
z Oracle Database Structure
z Oracle Database Access
z Tuning Considerations
z Oracle Database Tuning
z Oracle Tuning Tools

06/14/2002 Hawkeye Technology, Inc. 2


Oracle Database Structure

06/14/2002 Hawkeye Technology, Inc. 3


Logical Structure

06/14/2002 Hawkeye Technology, Inc. 4


Logical Structure
z Tablespaces
z SYSTEM
z RBS or UNDO
z TEMP
z User Data and Indices
z Schema
z Tables and Indices
z Segments (Data, Index, RBS, Temp)
z Extents
06/14/2002 Hawkeye Technology, Inc. 5
Physical Structure

06/14/2002 Hawkeye Technology, Inc. 6


Physical Structure
z Database
– Data
– Parameter Files
z Instance
– Processes
– Memory Structures

06/14/2002 Hawkeye Technology, Inc. 7


Physical Database
z Data Files
z Redo Log Files
z Control Files
z Parameter File
z Archive Log Files

06/14/2002 Hawkeye Technology, Inc. 8


Parameter File
z Read at instance startup
z Specifies values for various system wide
parameters
z Size parameters
– SGA, db buffer, sort area size, …
z Tuning parameters
z…

06/14/2002 Hawkeye Technology, Inc. 9


Database Instance
z Processes
– Process Monitor (PMON)
– System Monitor (SMON)
– Database Writer(s) (DBWRx)
– Recovery (RECO)
– Archiver (ARCx)
– Checkpoint (CKPT)
– Log Writer (LGWR)
– Server Processes ….
z Memory Structure
– System Global Area (SGA)
– Program Global Area (PGA)
06/14/2002 Hawkeye Technology, Inc. 10
Memory Structure
z SGA
– Database buffer cache
– Redo log buffer
– Shared Pool
z Shared SQL Area
z PL/SQL Procedures and Packages
z Dictionary Cache
– …
z PGA
– Heap
– Sort Area
06/14/2002 Hawkeye Technology, Inc. 11
Oracle Database Access

06/14/2002 Hawkeye Technology, Inc. 12


Database Connection
z Sql*Net
z Listener
z Server Process

06/14/2002 Hawkeye Technology, Inc. 13


Data Access
z Access data via SQL or PL/SQL
z Processing of SQL in three phases:
– Parse
– Execute
– Fetch
z Execution plan depends on the optimizer mode:
– Role based
– Cost based

06/14/2002 Hawkeye Technology, Inc. 14


Tuning Considerations

06/14/2002 Hawkeye Technology, Inc. 15


Tuning Considerations
z OLTP vs DSS
z Response Time vs Throughput
z Response Time = Service Time + Wait
Time
z Tuning Tradeoffs
– Affect of tuning on rest of the system

z Frequency of use

06/14/2002 Hawkeye Technology, Inc. 16


Special Tuning Considerations
z Oracle Parallel Server
z Multi-Threaded Server
z Replication
z Distributed Queries

06/14/2002 Hawkeye Technology, Inc. 17


Consider All Options
z Business Rules
z Database Design and Application Design
z System Architecture
z Network: LAN and WAN
z System: Hardware and Operating System
z Application Tuning
z Database Tuning
06/14/2002 Hawkeye Technology, Inc. 18
Oracle Database Tuning

06/14/2002 Hawkeye Technology, Inc. 19


Proactive vs Reactive
z Proactive Tuning
– Balance IO Distribution
– Manage Object Extents
– Manage batch jobs
– Manage long running and poorly tuned queries
– Database parameter review and tuning
– …
z Reactive Tuning
z React to a trouble report or performance problem

06/14/2002 Hawkeye Technology, Inc. 20


Tuning Steps
z Identify and define the problem
z Set clear and measurable tuning goals
z Take initial performance measurements
z Iteratively apply tuning changes and
measure performance on TEST system
z Document ALL tuning changes
z After goal is reached, apply changes to
PRODUCTION.
06/14/2002 Hawkeye Technology, Inc. 21
What Is Tunable in Oracle
z File placement
z DB Block Size
z SGA Size
z Listener setup
z Init Parameters
z Table/tablespace mapping
z Table/Index parameters
z RBS/Undo parameters
z Other Features: OPS, Replication, MTS, …
06/14/2002 Hawkeye Technology, Inc. 22
How to Tune
z SQL Statements
z Can they be rewritten for better data access?
z Review Execution plan for use of Indexes
z Resource Contention
z RBS or Undo
z CPU
z Memory
z IO
z Network

06/14/2002 Hawkeye Technology, Inc. 23


How to Tune
z RBS or Undo Contention
z Add more Rollback Segments
z Change RBS segment size
z CPU Contention
z Tune SQL
z Distribute workload to off-peak hours
z Add more CPU
z Memory Contention
z Change SGA size
z Change PGA size
z Consider Multi-Threaded Server Config

06/14/2002 Hawkeye Technology, Inc. 24


How to Tune
z IO Contention
– Moving Data files to balance IO
– Moving Tables to different Tablespace to balance IO
– Adding/Removing Indexes
– Change table structures: going to Partioned tables
– Maybe consider Tuning SQL
– Review fragmentation including chained/migrated rows
z Network Contention
– Adding LAN/WAN resources
– Modifying Listener configuration
– Review application design

06/14/2002 Hawkeye Technology, Inc. 25


Oracle Tuning Tools

06/14/2002 Hawkeye Technology, Inc. 26


Oracle Tuning Tools
z ExplainPlan
z SQL Trace
z Session Level
z System Level
z Dynamic Performance Views
V$SYSSTAT V$SESSSTAT V$WAITSTAT
V$SGASTAT V$ROLLSTAT V$LATCH
V$LIBRARYCACHE V$SORT_USAGE V$SQLAREA

06/14/2002 Hawkeye Technology, Inc. 27


Oracle Tuning Tools
z UTLBSTAT and UTLESTAT
z STATSPACK
z Oracle Enterprise Manager
z Performance Tool Vendors
– Quest Software
– Precise
– ….

06/14/2002 Hawkeye Technology, Inc. 28


Contact Information
Ashok Kapur
Hawkeye Technology, Inc.
561-236-4204
afkapur@hawkeyetechnology.com
http://www.hawkeyetechnology.com

06/14/2002 Hawkeye Technology, Inc. 29

You might also like