Oracle Performance Tuning
Four Day
Syllabus
Day 1:
1 1:
Introduction to Oracle tuning
- The top-down approach to tuning
- The
history of Oracle tuning
- A review of the Oracle architecture
-
The goals of Oracle tuning
- Overview of SQL tuning
- Oracle
network bottlenecks
- Oracle RAM usage and bottlenecks
- Oracle
CPU usage and bottlenecks
- Oracle disk I/O overview
-
Monitoring server (sat, vmstat, top, glance)
- Movement toward
server consolidation
-
Exercise: Monitor CPU
1 2:
Oracle disk I/O tuning
- History of DASD
- Understanding disk I/O
- Monitoring disk I/O (AWR, dba_hist_filestatxs)
- Sorted hash
cluster tables
- Disk I/O waits
- Oracle data buffer internals
(db_cache_size)
- Caching data blocks in the PGA (parallel
full-table scans)
- Blocksize and I/O performance
- Exercise view tablespace
fragmentation
1 3:
Oracle CPU Tuning
- Finding your cpu_count
- Measuring CPU usage
with vmstat
- Oracle CPU usage
- Using processor affinity
-
_optimizer_cost_model=cpu
- Parallel query and CPU
- Exercise:
Timing a parallel query
1 4:
Oracle RAM tuning
- all_rows and first_rows optimization and RAM
- Multiple data buffers
- Multiple blocksizes
- Measuring RAM
paging
- Oracle SGA RAM
- Oracle PGA RAM
- Using the KEEP
pool
- Automatic Memory Management (AMM)
- Exercise: Use the KEEP pool
1 5:
Oracle Instance Tuning
- Global tuning techniques
- Display possible
unnecessary large-table full-table scans
- Library cache tuning
- Finding missing indexes
- Tuning the database writer
-
instance parameter tuning
-
Exercise change optimizer parameters
1 6:
Oracle SQL Tuning Introduction
- SQL tuning hierarchy
- SQL tuning goals
-
optimizer modes
- query re-write
- cursor_sharing
- viewing
execution plans (autotrace)
- verifying optimal join techniques
- parallelizing SQL execution
- dynamic statistics
- Exercise count times when a
table is invoked
- 12c new SQL features
- function-based virtual column
- adaptive execution plans
- 12c new optimizer metadata collection features
*************************************************
DAY 2
2 1:
AWR and ASH
- AWR vs STATSPACK
- Reading an AWR report
- AWR report analyzer
- Basics of predictive modeling for
performance
- Finding repeating signatures of data
2 - 2:
Oracle RAC Tuning
- RAC architecture tuning
- Tuning disk I/O on
RAC
- Tuning the cache fusion layer on RAC
2 3:
Oracle Tuning Pack
- creating SQL Profiles
- Recommending new
indexes
- automatic SQL Tuning
- SQL Performance Advisor (SPA)
- recommending object reorganization
2 5:
Oracle Diagnostic pack
- AWR and ASH
- real time SQL monitoring
-
comparing performance periods
- Oracle monitoring & alert
notifications (setting thresholds)
2 6:
Oracle Tracing
- 10046 tracing
- TKPROF tracing
- Trace
analyzer
- Autotrace
*****************************************
Day 3
Introduction to SQL Tuning
3 1:
Introduction to SQL tuning
- Pre-SQL database communications
- The
evolution of SQL
- Declarative
languages
- Exercise Show
permutations of the same query
3 2:
Optimizing Oracle SQL
- Parsing a SQL statement
- Semantic parsing
- Hard parse vs. soft parse
- Decision tree generation
-
Making SQL reentrant
-
Exercise generate a syntax and semantic error
3 3:
Optimizer statistics
- Types of metadata
- Index metadata
-
Segment metadata
- Server metadata
- System stats
-
Exercise run dbms_stats
3 4:
Exposing & Reading Execution Plans
- autotrace
- SQL*Trace
- Determine the
steps of an execution plan
-
Exercise: determine the sequence of steps in a complex execution plan
3 5:
altering execution plans
- Changing CBO statistics
- Changing init.ora
SGA parameters
- Changing optimizer parameters
- Using hints
- Using the opt_param hint
3 6:
Oracle indexing
- Overview of Oracle indexing
- bitmap indexes
- bitmap join indexes
- guidelines for creating indexes
-
function-based indexes (FBI)
- index usage monitoring
- fishing
in the library cache
- optimizing indexes
- The transient nature
of indexing
- database modality of workloads
- SQL Workload
analysis
- Identifying EOW, EOM and EOY SQL.
- Creating
on-demand indexing
- oracle text indexes
- Exercise create an index on
the pubs database
DAY 4
Advanced Topics in Tuning
4 1:
Boolean/Built-in functions
- Boolean evaluation
- Decode and case
-
Basics of BIFs
-
Function-based indexing
- Creating a custom BIF using PL/SQL
- The effect of BIFs on
SQL execution
- Exercise: Write a custom built-in function
4 2:
tuning Oracle sorting
- Basics of sorting
- RAM usage in a hash join
- RAM for indexes
- Use indexes to avoid sorts
- Sorts in
execution plans
- Sorts in semi joins
- Use autotrace to see
sorts
- What causes sorts?
- PGA and sorting
- super-sizing
your PGA to avoid disk sorts
- sorted hash clusters
- Exercise: avoid sort by
retrieving data in pre-sorted order
Exercise: Use an index hint
to avoid sort
4 3:
Tuning Oracle subqueries
- Subquery overhead
- Scalar subqueries
-
In-Line views
- Correlated vs non-correlated subqueries
- WHERE
clause query re-write
- Tuning IN and NOT IN subqueries
- Tuning
EXISTS subqueries
- Tuning correlated subqueries
- Using
subquery hints (push_subq)
- Avoiding subqueries
-
Non-correlated subqueries and NOT IN clause
-
Automatic rewrite of EXISTS subqueries
- The merge_aj hint
- The anti-join hints
-
Exercise: Tune a subquery
4 4
Tuning with temp objects (materialized views, global temporary tables)
- Tuning with temporary tables
- Oracle global
temporary tables (GTT)
- The Oracle SQL WITH clause
- Exercise:
Test query rewritten to use temp tables
4- 5: Tuning full-table scans
- Basics of file multiblock I/O
- Deciding
when to invoke full-table
scan
- RAM caching in the SGA
- Automating table caching (KEEP
Pool)
- Solid State Disks and full-table scans
- Using
plan9i.sql to find full-table scans
- Tracking full-scans over time
with AWR
- Exercise: Find
high disk read SQL
4- 6:
tuning parallel query
- Parallel query
- Parallel DML
- Parallel
DDL
- Parallel utilities
- Setting optimal parallel degree
-
RAC and parallel query
- Parallel query tuning and buffering
-
Parallel query hints
-
Exercise: Invoke parallel query
***************************************************
Time
permitting:
5 1:
Oracle optimizer goals
- Roadblocks to SQL tuning
-
optimizer_index_cost_adj
- Global changes and SQL tuning
(parameters, statistics, reorganizations)
- Using the rule-based
optimizer as a testing tool
- Configuring the optimizer
-
Changing optimizer_mode
- Governors for the optimizer
- Using
hidden parameters
- Using the opt_param hint
- gathering
workload statistics
- optimizer_cost_model
- Exercise change
optimizer_mode