Professional Documents
Culture Documents
Mark Gordon
IBM Solutions Technical Sales Support
Version: 1.0
Date: January 22, 2015
1.
Disclaimers..................................................................................................................................................... 3
2.
Trademarks ................................................................................................................................................... 3
3.
Version Changes............................................................................................................................................ 3
4.
Feedback ........................................................................................................................................................ 3
5.
Introduction ................................................................................................................................................... 4
6.
6.1.
6.2.
6.3.
6.4.
6.5.
Configure CDC........................................................................................................................................ 11
6.6.
6.7.
7.
Summary ...................................................................................................................................................... 26
Page 2
1. Disclaimers
Using DB2 with BLU Acceleration Shadow tables is not currently supported by SAP.
This paper documents configuring SAP ERP with shadow tables in DB2 with BLU Acceleration, to support adhoc queries on line-item data. It is a demonstration of feasibility, not a best practices guide.
2. Trademarks
DB2 is a registered trademarks of IBM Corporation.
SAP and SAP NetWeaver are registered trademarks of SAP SE.
3. Version Changes
Version 1.0: January 22, 2015 initial version
4. Feedback
Please send comments or suggestions for changes to gordonmr@us.ibm.com.
Page 3
5. Introduction
This paper supplements the IBM document "Improve performance of mixed OLTAP workloads with DB2
shadow tables", which is available on IBM Developerworks at
http://www.ibm.com/developerworks/data/library/techarticle/dm-1409oltap-db2-shadow-tables/index.html.
That document describes the architecture of shadow tables in DB2. Please review it.
DB2 BLU columnar shadow tables can be used to optimize ad-hoc query on large tables, such as performing
ad-hoc queries on line-item data in a transactional ERP system. With BLU columnar tables, no ETL process is
needed to move the line-item data to an external system optimized for query -- queries can be executed directly
in the system where the line-item data resides.
We add information on the steps necessary to prepare DB2 using DBACOCKPIT and the SAP and DB2
configuration necessary to enable using shadow tables on an SAP system. We also demonstrate configuration
of CDC using the Management Console, rather than the command line configuration shown in the
Developerworks document.
Using DB2 shadow tables does not require any SAP customization. DB2 chooses whether to execute each SQL
statement on the source row table or its columnar shadow table depending on which should perform better.
Since no application changes are needed, one can test BLU shadow tables to optimize any program. BLU
shadow tables are most likely to help programs with varied input parameters that access many rows from tables,
such that indexes cannot be created to optimize all program variants. When SQL joins two or more tables, all
tables must have columnar shadow tables, in order for that SQL to be executed on the shadow tables.
The shadow tables are replicated via CDC reading the log, so changes in the shadow tables are asynchronous
from the application changes to the row tables. As with architectures that use trigger based replication to
columnar tables, the columnar shadow tables may be a few seconds or minutes behind the state of the row
tables.
Page 4
6.1.
As described in "Improve performance of mixed OLTAP workloads with DB2 shadow tables", DB2 10.5
FP4 is required for shadow tables. SAP has a special build, "DB2 10.5 FP4SAP", that should be
downloaded from SAP SMP for DB2 update or install.
See SAP note 2047006 regarding SAP kernel levels required for using INTRA_PARALLEL=YES with
OLTP systems. INTRA_PARALLEL=YES is used for columnar table access plans. If an older kernel is
used, then DB2 parallelism will not be used for SQL on the columnar shadow tables. Our test environment
used 7.41 SPl (patch number) 100.
InfoSphere CDC Access Server Interim Fixes are cumulative. We installed InfoSphere CDC Access Server
Interim Fix 8 on the SAP DB server.
InfoSphere CDC Interim Fixes are not cumulative. We installed the base product InfoSphere for DB2 for
LUW 10.2.1 on the SAP DB server, and then installed Interim Fix 15 to update it.
InfoSphere CDC Management Console Interim Fix 8 was installed on a Windows PC.
Depending on the release of SAP, either SYSTOOLS or SYSTOOLSPACE may be used for the TOOLS
tablespace. Check which it is. This will be needed later. It was SYSTOOLSPACE on our test system.
6.2.
The DB2 test system has 64GB memory. Using DB2 command or DBA cockpit, we set the following DBM
and DB parameters for our test system BED. "Improve performance of mixed OLTAP workloads with
DB2 shadow tables" describes the recommended relationship between them.
Page 5
"Improve performance of mixed OLTAP workloads with DB2 shadow tables" has configuration instructions
for special register settings in the section" Enabling query routing to shadow tables". Since SAP issues the
SQL from the app server, we cannot use these special register settings for shadow table configuration
with SAP. Instead, we updated the DB parameters for our test DB "BED" with the following commands:
update db cfg for BED using DFT_DEGREE ANY
update db cfg for BED using DFT_MTTB_TYPES REPLICATION
update db cfg for BED using DFT_REFRESH_AGE 120
Since the default optimization level for SAP is 5, which allows optimization with shadow tables, the
optimization level does not need to be changed.
Page 6
6.3.
DB2 recommends using 32K page size tablespace with extent size of 4. Since our system uses the default
16K page size, we create a new bufferpool and tablespace with DBACOCKPIT.
Page 7
Page 8
In Figure 8, specify a Table space Name, select Page Size 32 KB, set extent size to 4, and for Buffer Pool,
specify the 32K buffer pool created above.
Page 9
In Figure 9, specify the size. Then refresh (to generate the SQL command) and press "Add ...".
As DB2 user (db2bed in our system), create catalog objects for replication, using TOOLS tablespace
determined in Figure 1.
6.4.
For each table that will be optimized with columnar shadow tables, do the following.
Page 10
In our tests, we created columnar shadow tables for BKPF, FAGLFLEXA, MKPF, MSEG, and BSIS.
6.5.
Configure CDC
Create the directory for CDC replication for our database BED.
Page 11
In Figure 15, specify Instance Name, and quota. Database username/password is the unix DB2 userid
created by the SAP DB install. Choose a Metadata Schema. Refresh loader path is the directory created in
Figure 13. Press OK.
Press "Yes".
Press "No".
Page 12
From directory in Figure 21, create administrative user, datastore, and link admin user, datastore and DB2
instance.
./dmcreateuser cdc-admin "N/A" "Administrator" cdc-admin-password sysadmin true false false
./dmcreatedatastore dscdcbed "db2bed OLTPDB Shadow Tables" atssg148 10901
./dmaddconnection cdc-admin dscdcbed BED db2bed db2bed-password false true false true
Login to CDC with Management Console
Page 13
At this point, there are no subscriptions in Figure 24. We will create one. Press "Configuration", then right
click for the menu of activities. Choose "New Subscription".
Page 14
In Figure 26, enter a subscription name and choose the target, which in our configuration is the same as the
source. Press "Advanced Settings".
Page 15
In Figure 27, select "Mark subscription as persistent". Press OK, then OK again.
Press "Yes".
Page 16
Press "Next".
Page 17
Page 18
Since we created the columnar shadow tables earlier, in Figure 33, select "Map to existing target tables",
and press "Next".
Page 19
In Figure 36, select the column table created earlier, and press "Next".
Page 20
Page 21
Press "Finish".
In Figure 40, we now see that BSIS is mapped to BSIS_SHADOW.
BSIS mapped, but replication is not active yet - the Status is "Refresh". After we map other tables, we will
start replication. In addition to BSIS, we mapped FAGLFLEXA, BKPF, MKPF, MSEG.
Page 22
Press "OK".
Page 23
6.6.
We used SQVI to create sample SQL to demonstrate shadow table usage. With a columnar copy of the
data in addition to the original row organized tables, the DB2 optimizer can choose whether to use the row
or column tables, based on the characteristics of the SQL.
The first three SQL examples are MKPF MSEG joins, such as are done in MB51 (material document list).
In this example, there is a filtering local predicate (MANDT=) on an indexed column of the row table
MSEG. DB2 chooses the row tables and index access.
Page 24
In Figure 47 neither AEDAT nor KUNNR is indexed, and DB2 chooses the column table join.
Page 25
6.7.
Since CDC starts DB2 applications, you need to shut CDC and Access Server down before you can stop
DB2. For startup, start DB2, then CDC, then access server. For shutdown, shutdown access server, then
CDC, then DB2.
CDC startup: dmts64 -I cdc_instance_name
CDC shutdown: dmshutdown -I cdc_instance_name
Access server startup: dmaccessserver
Access server shutdown: dmshutdownserver
7. Summary
CDC shadow tables are not currently supported with SAP. But, they can be configured and tested with DB2
and SAP as shown above.
No customization changes are needed in SAP, so any SAP transparent table can be tested as a columnar shadow
table. The DB2 optimizer will choose whether to execute a query on row or columnar table based the
optimizers evaluation of where the SQL will perform best.
Page 26
Page 27
Page 28