Sei sulla pagina 1di 64

Release 11i

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

“One of the biggest factors


contributing to the performance
of the upgrade process, as well as
post-upgrade or post-
implementation performance is a
properly fed Cost-Based
Optimizer.”

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.

 Rule Based Optimizer


A fixed ranking system to determine the
most efficient access method when
executing a SQL statement.

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

execution plan based on statistics in the


data dictionary.
 The optimizer compares the costs of the

execution plans and chooses the one


with the lowest cost.

5
© 2002 Solution Beacon, LLC. All Rights Reserved.
Cost Based Optimizer Basics

 How Does CBO Work?


 CBO Care
 init.ora parameters

 CBO Feeding

 DBA Food

• Gather Statistics
 Developer Food

• SQL Tuning

6
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Care

 Oracle Applications 11i require particular


init.ora parameters to be set up for the
CBO use:
 Check current init.ora parameters settings:
$FND_TOP/sql/AFCHKCBO.sql script
OR
from SQL*Plus, query v$parameter table:
select name, value from v$parameter;

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

 Recommended init.ora Parameter


Settings:
 _complex_view_merging = TRUE
 _sort_elimination_cost_ratio = 5

 _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

(indicates to the CBO how often index


blocks are cached in the Buffer Cache
default 0)
 optimizer_index_cost_adj = 10
(tells the CBO how expensive index
scans are in relation to full-table
scans default 100)

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

statistic (Not ANALYZE, Not DBMS_STATS)


 Sample FND_STATS package procedures:

 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

SQL > exec fnd_stats.gather_schema_statistics (‘AR’) ( For


a specific schema )
SQL > exec fnd_stats.gather_schema_statistics (‘ALL’)
( For all schemas )
SQL > exec fnd_stats.gather_schema_statistics (‘GL’, ‘GL_JE_LINES’)
( For one table )

13
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding
Generating Statistics in 11i

Using the System Administrator


responsibility run the following concurrent
programs to generate statistics:
 Gather Table Statistics
 Backup Table Statistics

 Restore Table Statistics

 Gather Schema Statistics

 Analyze All Index Column Statistics

14
© 2002 Solution Beacon, LLC. All Rights Reserved.
Gather Table Statistics

15
© 2002 Solution Beacon, LLC. All Rights Reserved.
Gather Table Statistics

 Gathers table statistics for the specified table


 Gathers all related index statistics by default
 If backup_flag is set to BACKUP, exports the
old statistics before gathering the new
statistics
 Old statistics are stored in FND_STATTAB table
 Uses GATHER_TABLE_STATS procedure

16
© 2002 Solution Beacon, LLC. All Rights Reserved.
Backup Table Statistics

17
© 2002 Solution Beacon, LLC. All Rights Reserved.
Backup Table Statistics

 Stores the statistics of the given table


unto the FND_STATTAB table.
 Backs up the related index and column
statistics by default.
 Uses different statistics identifiers
 Can keep different versions of backup
with different identifiers.
 Uses BACKUP_TABLE_STATS procedure

18
© 2002 Solution Beacon, LLC. All Rights Reserved.
Restore Table Statistics

19
© 2002 Solution Beacon, LLC. All Rights Reserved.
Restore Table Statistics

 Restores the previously backed up


table statistics from a given
statistics identifier.
 Imports index and column statistics
associated with the specified table
 Uses RESTORE_TABLE_STATS
procedure

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

 Analyzes all the indexed columns for


all the tables in a given schema
 Backs up statistics into the
FND_STATTAB table before gathering
statistics
 Uses ANALYZE_ALL_COLUMNS
procedure

24
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding

 Now Obsolete Programs:


 Gather Column Statistics
 Gather All Column Statistics

 See MetaLink Note 141532.1 

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?

 Have histograms been created for skewed data?

 Has statistics usage been monitored?

 Does your release 11i contain customizations?

 Send a Trace file.

28
© 2002 Solution Beacon, LLC. All Rights Reserved.
Histograms

 Create for tables with Skewed Data


 Large differences exist between ranges of
values
 For Example
 Seasonal Business. Caps and Gowns
Orders By Month
Jan Feb Mar Apr May June July Aug Sep Oct Nov Dec
1 5 200 500 500 200 40 1 1 1 5 1
 Histograms can only be used on literals
(yes/no, open/close)

29
© 2002 Solution Beacon, LLC. All Rights Reserved.
The Big Difference

KNOW YOUR DATA

30
© 2002 Solution Beacon, LLC. All Rights Reserved.
Miracle Cure – SQL Tuning

 Does not Exist


 Every Business Is Different
 All Depends on the Data
 Can Change Over Time

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;

 Parse the Information


 Information stored in PLAN_TABLE
where statement_id = “FEED_ME”
(MetaLink Note:156959.1)

33
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Feeding – SQL Tuning

EXPLAIN PLAN
SET statement_id = “FEED_ME”
FOR select * from dual;

 Extract information from


PLAN_TABLE
where statement_id = “FEED_ME”

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

the costs and plans for all sql


tkprof tracefile outputfile [explain= ]
[table= ] [print= ] [insert= ] [sys= ]
[sort= ]

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

 Determine if code can be improved using indexed


fields
 Only for custom code

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

 Rule Based Optimization

 Specific Index

 Can place a hint on Concurrent Programs

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

 Items Worth Noting


 Trace Files and Explain Plan from 3rd
party may differ.
 Index chosen references fields not

existing in where clause

40
© 2002 Solution Beacon, LLC. All Rights Reserved.
CBO Tools, Tips & Tricks
 How to determine when statistics were last
gathered?

 Run FND.STATS.VERIFY_STATS to check when statistics


were last gathered.
Example:
SQL> set server output on
SQL> set long 10000
SQL> exec fnd_stats.verify_stats
(‘QP’, ‘QP.QP_LIST_LINES’);

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

 Use bde_last_analyzed.sql script


from Oracle support
 Validates statistics for all tables
 Use it when bad overall database

performance is noticed
 Generates bde_last_analyzed.txt report

 For more info see Metalink Note

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

 When Should You Gather Statistics?


 The right schedule depends on your data
and how often it changes
 Recommendation gather the CBO statistics

at least once per week


 Gather statistics more frequently on the

tables with high number of transactions

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:

 a large amount of data has been entered into


your system
 an upgrade

 applying mini packs or maintenance packs

 Understand what actions cause dramatic

differences in the number of records in a table


(inserts, updates, deletes)

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?

 When object statistic are refreshed all

references to that object become invalid


in the shared pool or library cache,
requiring a new hard parse for each sql
statement referencing the object

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

© 2002 Solution Beacon, LLC. All Rights Reserved.


11i and Data Growth Management
The game has changed!

 Upgrade storage explosion 20-50%


 11i storage growth rate increase 20-
400%
 New data model = more

data/transaction
 Reduce custom code

 Consolidate software packages

 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

Unmanaged Data Growth

52
© 2002 Solution Beacon, LLC. All Rights Reserved.
11i and Data Growth –
Financials Earlier Adopter
70.00

60.00 10.7 Growth 11i Growth


1.5 GB/month 2.5 GB/month
50.00
69% increase
Data in GB

40.00

30.00

20.00 26% Data Growth


At Upgrade
10.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)

Daily Total Run Time (Hours)


4.5 400

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

Concurrent Program run times 1st Year on 11i

Average Run Time: Total Run Time:


Increase 43% Increase 78%

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

Conclusion: Archive early in 11i life-


cycle 55
© 2002 Solution Beacon, LLC. All Rights Reserved.
Where is this growth coming from?
 New 11i Data Model =More data per transaction
 Order Management

 OE to OM = 1.5 X increase

 Workflow = additional increase

 Payables

 New Accounting Entries tables = 1.5 X

increase
 Workflow

 Used across several applications

 Data growth and performance impact

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

 Get patch current before you start

 Users won’t give up the data


 Users demand access to archive

data.
 Ideally via the application interface.

 Oracle Purges do not provide


access to purged data.

58
© 2002 Solution Beacon, LLC. All Rights Reserved.
Access to Archive Data is the Key

 To get user buy in on purging you


will need an Archive solution.
Considerations:
 One time purge or ongoing?
 Frequency of ongoing purges?

 User access to data?

 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

 Customization and interface impact

 Functional:

 Business process impact

 Set data retention parameters

 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

database beyond your hardware.

62
© 2002 Solution Beacon, LLC. All Rights Reserved.
Learn More About 11i and Archiving?

 Fall OAUG 2002


 Oracle 11i Data Upgrade Roadmap – A Lifecycle-Based Approach,

Grant Gasson, Director of Financial Systems Apollo Group, Inc.


 Data Migration Strategies for Oracle 11i Upgrades, Rich Butterfield

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

Ward, Kenny Howat Eaton Corporation

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.

Potrebbero piacerti anche