Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Performance Tuning
Workshop – Implementations
& Post Go-Live
INSTRUCTORS
• Sandra Vucinic – SSI North America
• Tammy Vandermey - WebCentrix
• Rich Butterfield - OuterBay Technologies
• Randy Giefer - Solution Beacon, LLC
CONTRIBUTORS
• Andy Rivenes – AppsDBA
• John Stouffer – Solution Beacon, LLC
1
© 2002 Solution Beacon, LLC. All Rights Reserved.
Baseline Education
2
© 2002 Solution Beacon, LLC. All Rights Reserved.
Baseline Education - CBO
Oracle Applications Release 11i
uses the cost-based optimization
(CBO) approach in choosing the
most effective way to execute SQL
statements.
3
© 2002 Solution Beacon, LLC. All Rights Reserved.
Cost Based Optimizer Basics
Definition:
Cost Based Optimizer
Determines the most efficient way to execute
a SQL statement based on statistical data
stored in the data dictionaries.
4
© 2002 Solution Beacon, LLC. All Rights Reserved.
Cost Based Optimizer Basics
How Does CBO Work?
The optimizer creates a set of potential
execution plans for the SQL statement
based on available access paths and
hints.
The optimizer estimates the cost of each
5
© 2002 Solution Beacon, LLC. All Rights Reserved.
Cost Based Optimizer Basics
CBO Feeding
DBA Food
• Gather Statistics
Developer Food
• SQL Tuning
6
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Care
7
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Care
Recommended init .ora Parameter
Settings:
optimizer_features_enable = 8.1.7
optimizer_mode = CHOOSE
_optimizer_undo_changes = FALSE
_optimizer_mode_force = TRUE
db_file_multiblock_read_count = 8
optimizer_max_permutations = 2000
8
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Care
_use_column_stats_for_function = TRUE
_like_with_bind_as_equality = TRUE
_or_expand_nvl_predicate = TRUE
_push_join_union_view = TRUE
9
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Care
Recommended init.ora Parameter
Settings:
_table_scan_cost_plus_one = TRUE
_push_join_predicate = TRUE
_fast_full_scan_enabled = FALSE
_ordered_nested_loop = TRUE
optimizer_percent_parallel = 0
query_rewrite_enabled = TRUE
compatible = 8.1.7
10
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Care
Two Often-Overlooked Parameters:
optimizer_index_caching = 90
11
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
Generating Statistics in 11i
Need To Keep Statistics Current !
FND_STATS package is used to generate
GATHER_INDEX_STATS
BACKUP_SCHEMA_STATS
RESTORE_TABLE_STATS
VERIFY_STATS
12
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
Examples:
Run FND_STATS package from SQL*Plus
13
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
Generating Statistics in 11i
14
© 2002 Solution Beacon, LLC. All Rights Reserved.
Gather Table Statistics
15
© 2002 Solution Beacon, LLC. All Rights Reserved.
Gather Table Statistics
16
© 2002 Solution Beacon, LLC. All Rights Reserved.
Backup Table Statistics
17
© 2002 Solution Beacon, LLC. All Rights Reserved.
Backup Table Statistics
18
© 2002 Solution Beacon, LLC. All Rights Reserved.
Restore Table Statistics
19
© 2002 Solution Beacon, LLC. All Rights Reserved.
Restore Table Statistics
20
© 2002 Solution Beacon, LLC. All Rights Reserved.
Gather Schema Statistics
21
© 2002 Solution Beacon, LLC. All Rights Reserved.
Gather Schema Statistics
Gathers specified schema level statistics
Backs up existing statistics
Creates the histogram for the specified columns in
the FND_HISTOGRAM_COLS tables
Populates default statistics for all the interface
tables as defined in the
FND_EXCLUDE_TABLE_STATS table
Uses GATHER_SCHEMA_STATS procedure
22
© 2002 Solution Beacon, LLC. All Rights Reserved.
Analyze All Index Columns
23
© 2002 Solution Beacon, LLC. All Rights Reserved.
Analyze All Index Columns
24
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
25
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
Gather Stats on Partitioned Tables
Pass ‘PARTITION’ in the Granularity parameter
OR
From SQL*Plus
SQL> begin
fnd_stats.gather_table_stats (
ownname => ‘APPLSYS’
tabname => ‘WF_ITEM_ACTIVITY_STATUSES’,
granularity => ‘PARTITION’);
end;
26
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
SQL Tuning
The Oracle Way (Metalink)
Explain Plans
Trace Files
Histograms
Hints
Join Methods
27
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
The Oracle Way (open an iTar)
Are the init.ora parameters present and correct?
Have statistics been gathered on tables and indexes?
28
© 2002 Solution Beacon, LLC. All Rights Reserved.
Histograms
29
© 2002 Solution Beacon, LLC. All Rights Reserved.
The Big Difference
30
© 2002 Solution Beacon, LLC. All Rights Reserved.
Miracle Cure – SQL Tuning
31
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning
Explain Plan
Run on problematic SQL to determine
the path CBO has chosen.
Identify Possible Full Table Scans
32
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning
Gather Information
EXPLAIN PLAN
SET statement_id = “FEED_ME”
FOR select * from dual;
33
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning
EXPLAIN PLAN
SET statement_id = “FEED_ME”
FOR select * from dual;
34
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning
Trace Files
Generate Trace File inside Application
TKPROF to interpret results and check
35
© 2002 Solution Beacon, LLC. All Rights Reserved.
Understanding Join Methods
Hash Joins
Better for relatively large table to
relatively small table
Must be equi-join
Sort/Merge
Must be equi-join
Nested Loops
36
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning
Indexes
Evaluate whether an index would improve
performance
Consider temporary indexes for batch processing
Create index prior to running nightly MRP
Run MRP
Drop index
37
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning
Hints
Used to provide Oracle with a suggested
path to take.
Only a suggestion, it may still choose
another path
Can hint to use
Specific Index
38
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning
Hint a Concurrent Program
39
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
40
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
How to determine when statistics were last
gathered?
41
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
Use coe_stats.sql script provided
by Oracle support
Verifies statistics for all tables owned
by installed apps modules
Generates COE_STATS.TXT report and
coe_fix_stats.sql script
For more info see MetaLink Note
156968.1
42
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
performance is noticed
Generates bde_last_analyzed.txt report
163208.1
43
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
How to determine when statistics were last
gathered?
Run the following sql query to for individual tables:
select table_name, num_rows, blocks, avg_row_len,
to_char (last_analyzed ‘MM/DD/YYYY HH24:MI:SS’)
where table_name in from dba_tables
(‘TABLE1’, ‘TABLE2’, ….’TABLEn’);
44
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
How to determine when statistics were
last gathered?
Run the following sql query to check indexes:
SELECT index_name, num_rows,
distinct_keys “DISTINCT”, leaf_blocks,
clustering_factor “CF”, avg_leaf_blocks_per_key
“AVG_LB”
FROM dba_indexes
WHERE table_name in (‘TABLE1’, ‘TABLE2’,
….’TABLEn’);
45
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
46
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
When Should You Gather Statistics?
Never gather CBO stats for SYS or SYSTEM
data dictionary objects
Gather statistic after:
47
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
When Should You Gather Statistics?
Gather statistics during low system load
periods, when number of active users is
minimum
Why?
48
© 2002 Solution Beacon, LLC. All Rights Reserved.
Questions & Answers
Thank you
Sandra Vucinic
Sandra.Vucinic@us.ssiworldwide.com
Tammy Vandermey
tammy@webcentrix.net
Randy Giefer
rgiefer@solutionbeacon.com
© 2002 Solution Beacon, LLC. All Rights Reserved.
Performance Tuning -
Archive/Purge
data/transaction
Reduce custom code
Consolidate geographies
51
© 2002 Solution Beacon, LLC. All Rights Reserved.
The Application Data Growth Paradox
Success = Problems
Cost
Performance Upgrade
Treadmill
Data
Inactive Data Instance de-
consolidation
Active Data
Time
52
© 2002 Solution Beacon, LLC. All Rights Reserved.
11i and Data Growth –
Financials Earlier Adopter
70.00
40.00
30.00
-
11i Upgrade Jun-01
Apr-01
Oct-01
Oct-00
Dec-00
Feb-01
Aug-01
Dec-01
Feb-02
53
© 2002 Solution Beacon, LLC. All Rights Reserved.
11i Considerations: Performance Decay
6.0 550
5.5 500
5.0 450
Daily Average Run Time (Minutes)
4.0 350
3.5 300
3.0 250
2.5 200
2.0 150
1.5 100
1.0 50
May-01
Dec-01
Mar-01
May-01
Jun-01
Nov-01
Dec-01
Jan-02
Feb-02
Mar-01
Jun-01
Jul-01
Oct-01
Nov-01
Jan-02
Feb-02
Jul-01
Oct-01
Sep-01
Sep-01
Aug-01
Apr-01
Apr-01
Aug-01
54
© 2002 Solution Beacon, LLC. All Rights Reserved.
11i Re-Implementation – WW Mfg
300
11i Re-implementation
250
Data in GB
200
10.7 Growth
150
3 GB/month
100
50
11i Growth
0 13 GB/month
Jun-01
Aug-01
Dec-00
Dec-01
Feb-01
Feb-02
Apr-02
Apr-01
Oct-01
4X+ increase
OE to OM = 1.5 X increase
Payables
increase
Workflow
dramatic
Less custom, consolidated applications,
consolidated geographies.
56
© 2002 Solution Beacon, LLC. All Rights Reserved.
What Can You do About Data Growth?
Most Common Oracle 11i Purges
Schema Purge
AP AP PO Purge
AR Call New Archive and Purge
BOM Delete Item Information
BOM Purge Standard Cost History
GL Archive and Purge
HR Payroll
INV Transaction Purge
OM Sales Orders
FA Asset Depreciation
PA Projects
PO AP PO Purge
WIP WIP Transactions
* For information on specific purges see OAUG Fall 2001 paper: An Online
Archive Solution Using Standard Purge Programs By Ziyad Dahbour
57
© 2002 Solution Beacon, LLC. All Rights Reserved.
Why Purges are not
Implemented?
Purges don’t work
Many fixes in the last 2 years
data.
Ideally via the application interface.
58
© 2002 Solution Beacon, LLC. All Rights Reserved.
Access to Archive Data is the Key
Upgrade path?
Speed of implementation?
59
© 2002 Solution Beacon, LLC. All Rights Reserved.
Archive Alternatives
Archive Options
Oracle Purge - Archive Support
Tape or Online Pre-purge Copies
Data Warehouse
Build it Yourself
Vendor Packages
BitbyBit
OuterBay
Crystallize
60
© 2002 Solution Beacon, LLC. All Rights Reserved.
Archive Implementation
Like implementing any new feature in Oracle
applications.
Project Team
Technical: Application, and DBA.
Initial purge testing
Patch application
Functional:
Testing
61
© 2002 Solution Beacon, LLC. All Rights Reserved.
Archive Implementation (continued)
Time Frame:
1 – 3 months to production
Start early, before 11i pushes your
62
© 2002 Solution Beacon, LLC. All Rights Reserved.
Learn More About 11i and Archiving?
OuterBay Technologies
Europe OAUG 2002
Worldwide Upgrade to Oracle 11i: A Recipe for Success, Robert P.
Dallesandro Parsons-Brinckerhoff
LIVING WITH FINANCIALS 11i – 18 MONTHS IN PRODUCTION Stefan
63
© 2002 Solution Beacon, LLC. All Rights Reserved.
Questions & Answers
Thank you!
Rich Butterfield
richb@outerbay.com
Randy Giefer
rgiefer@solutionbeacon.com
64
© 2002 Solution Beacon, LLC. All Rights Reserved.