Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
February 2009
Preface................................................................................................ 1
Requirements...................................................................................... 1
Partitions – SAP-related notes ............................................................ 2
Partitions – What do you have to change on the ABAP side? ............ 2
Partitions – When does it make sense to partition your data? ............ 3
Partitions – Types ............................................................................... 4
Partitions – Leading zero issue with SAP ........................................... 6
Partitions – How to ensure valid ranges.............................................. 6
Partitions – Cost-based optimizer ....................................................... 8
Partitions - Indexes ............................................................................. 9
Partitions – Merge and split operations ............................................. 10
Partitions – Advantages for you ........................................................ 11
Partitions – Roadmap........................................................................ 11
Oracle White Paper—Oracle Partitioning for SAP
Preface
This paper provides
an overview of Oracle
This document explains how Oracle partitions are used in the SAP environment.
partitions in the SAP Partitions have been available and used outside the SAP environment for a long time.
environment SAP began using partitions for their data warehouse solutions starting with BI 2.0. In
“standard” NetWeaver configurations, partitions are only used for certain customer sites.
Requirements
To use Oracle partitions, you need to have the “Oracle Partition Option” licensed. During
the standard SAP/Oracle installation process, the Partitioning option is always installed
(see also OSS note #859841 – Uninstall of Oracle Partitioning software option).
As mentioned above, SAP BW/BI has been using Partitions for many years. With
“standard” SAP, partitions can be used as of 4.6C – service pack 48. From this version
on, the SAP data dictionary is able to handle partitioned tables. If using older releases,
you were able to set up partitioned tables on the database side, but if you wanted to
apply changes to such a table, the partitioning setup might have been erased.
1
Oracle White Paper—Oracle Partitioning for SAP
2
Oracle White Paper—Oracle Partitioning for SAP
First example:
A manufacturing customer with independent plants and independent products in each plant. It is
therefore possible that each plant has its own special reports. For internal cost reasons each plant
is charged internally for the amount of space used.
Solution:
Partition the related data on a plant basis and separate it into different tablespaces (SAP column
“werks”). This can be done using “LIST partitioning”.
IS-U customers typically have exceptionally large tables (DFKKxx, DBERCHZ1). Such tables
are becoming highly critical for handling as well as for performance reasons. It is usually the case
that only the last few weeks/months contain critical data.
Solution:
Partition based on ranges (e.g. FKKBELEG) and each range has approx. one million rows
(=same amount of data in each partition).
3
Oracle White Paper—Oracle Partitioning for SAP
Third example:
Retail customers typically have such a high throughput within their SD tables, that permanent
archiving is carried out. This deletes data and the empty space produced is reused very quickly.
Typically not all data is archived so some data remains in the table blocks. This may result in a
drop in SGA efficiency.
Solution:
Partition based on ranges (e.g. VBELN). Because SAP typically increments such ranges (NRIV),
a new SD document will always be assigned a higher number. If archiving now takes place,
“OLD” data (blocks) will not be affected and new data will only be placed in the new partitions. In
addition, if archiving is undertaken, the now empty (or almost empty) “old” partitions can be
merged and the space will be returned to the tablespace
Partitions – Types
Oracle supports different types of partitions, including sub-partitions. SAP does not support sub-
partitions; all “simple” partitions are supported
Range partitions:
As the name suggests, range partitions cover ranges. These ranges are typically
ranges of numbers. Example:
4
Oracle White Paper—Oracle Partitioning for SAP
List partitions:
text varchar2(100))
Hash partitions:
text varchar2(100))
partitions 4
5
Oracle White Paper—Oracle Partitioning for SAP
...
PARTITION BY RANGE
("OPBEL")
...
6
Oracle White Paper—Oracle Partitioning for SAP
Examples:
Range partitions:
List partitions:
text varchar2(100))
7
Oracle White Paper—Oracle Partitioning for SAP
Example:
SQL> explain plan for select * from test_part where t1 = :a0
Explained.
Instead of a “real” full table scan, only the second partition (see example above) is used.
8
Oracle White Paper—Oracle Partitioning for SAP
Partitions - Indexes
The topics discussed so far relate to tables, but what about indexes? Can or should we partition
indexes too?
In most cases, your partition key for range partitions will be one of the columns of the primary
key and we would therefore recommend partitioning the index in the same way. But can we use
setup partitioning for secondary columns such as a sales region while the table is partitioned based
on a different column, e.g. VBELN.
An index which follows table partitioning is called a “local index”. Here we distinguish between a
“prefixed” (first column of the index is the partition key) and a “non-prefixed” (partition key is
part of the primary key) index.
create index i_test_part
on test_part (t1)
local
But, as mentioned above, you can also create partitioned indexes based on columns
which are not part of the partition key for the table. Such indexes are called
“global partitioned indexes”.
These indexes are typically created for performance reasons (special reports). They can also be
processed using parallel query if un-partitioned indexes could not be processed in parallel (for
range scans).
Please note:
If you define “global indexes”, these indexes need to be maintained if you perform specific
operations for your table (create a new partition, drop a partition, merge/split partitions, …).
If your global indexes are not updated during these operations, they will become unusable.
Since 10g, the CBO does not take into account “unusable” indexes (parameter
skip_unusable_indexes = true), but performance problems may occur until you rebuild indexes
which are in a usable state (“update indexes” clause). In addition, as of 10g you can also specify
the “update indexes” clause for partition maintenance commands and this will also update your
global indexes.
9
Oracle White Paper—Oracle Partitioning for SAP
Examples:
(PARTITION EDIDS_P01_00031,
PARTITION EDIDS_P01_MAX)
"EDIDS_P01_00079","EDIDS_P01_00080"
10
Oracle White Paper—Oracle Partitioning for SAP
Partitions – Roadmap
• Identification of possible partitioning candidates with a direct or indirect time dependency, a
good “LIST” candidate or just distribute your data (hash partitions) to prevent table/index hot
blocks
• Start with simple tables (only primary index)
• Do not forget the “left-over” partition
• Implement scripts for administrating partitions (spare partitions, split, merge, drop)
• Implement more complex tables with secondary indexes
• Do not forget to test your implementation
11
Oracle Partitioning for SAP
February 2009
Author: Juergen Kirschner
Contributing Authors: Stephan Buehne,
Hanno Bresch
Copyright © 2009, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and
the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other
Oracle Corporation
warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or
World Headquarters
fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are
500 Oracle Parkway
formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any
Redwood Shores, CA 94065
means, electronic or mechanical, for any purpose, without our prior written permission.
U.S.A.
Worldwide Inquiries: Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective
Phone: +1.650.506.7000 owners.
Fax: +1.650.506.7200
oracle.com 0209