39
Wal-Mart Bentonville, AR Migration from Informix to DB2 UDB Functionality Issues Addressed July 2004 Created by: Shelton Reese IBM DB2 UDB Consulting Services Chicago, Illinois Last Updated: Friday, June 26, 2009 Version 1.0 Version level – 1 st Draft

Wal Mart Problem Analysis

  • Upload
    sjreese

  • View
    609

  • Download
    7

Embed Size (px)

DESCRIPTION

A look at Wal-Mart\'s conversion to DB2

Citation preview

Page 1: Wal Mart Problem Analysis

Wal-Mart

Bentonvil le, AR

Migration from Informix to DB2 UDB

Functionality Issues Addressed

July 2004

Created by: Shelton Reese

IBM DB2 UDB Consulting Services

Chicago, Illinois

Last Updated: Friday, June 26, 2009

Version 1.0

Version level – 1st Draft

Page 2: Wal Mart Problem Analysis

Page 2 of 39

Page 3: Wal Mart Problem Analysis

Revision History

Revision Section Description Editor Date

0.1 All Document created SR 7/21/04

Page 3 of 39

Page 4: Wal Mart Problem Analysis
Page 5: Wal Mart Problem Analysis

Table of Contents

............................................................................................................................................. 1 Introduction ...................................................................................................................... 2 Getting Started ................................................................................................................ 2 Federated/Nickname limitations ...................................................................................... 2 DB2 Database Management ........................................................................................... 3 DB2 Space Management .................................................................................................. 3 DB2 Database Upgrade and Patches ............................................................................... 4 DB2 installation flexibility of location of binaries .......................................................... 5 DB2 SQL Alter Table command for user controlled column placement ........................ 5 DB2 Optional Logging by turning it off .......................................................................... 6 DB2 Stored Procedure compiler needs to be optional .................................................... 8 DB2 encryption and security ........................................................................................... 8 DB2 Unicode compatibility between all platforms of the DB2 family ........................ 10

Obsolete CLI/ODBC Keyword Values ..................................................................... 10 Literals in Unicode Databases .................................................................................. 10

Next Steps for DB2 ....................................................................................................... 11 Appendix A .................................................................................................................... 13 Monitoring Database OW_DEV for 30 seconds ........................................................... 17

Page 1 of 39

Page 6: Wal Mart Problem Analysis

Wal-Mart’s Migration from Informix to UDB Functionality Issues Addressed

Introduction

While supporting DB2/UDB at Wal-Mart, Mr. Alan Jamison (479-277-5401) asked if there were any ways of addressing Wal-Mart’s issues in the very near term. These issues have to do with the following:

• DB2 Federated/Nickname limitations

• DB2 System Management, as to how the configuration file is handled at the database level• DB2 database manager synchronization for thousands of servers • DB2 Space Management with layout and upfront sizing

• DB2 unattended upgrade and fix pack installs for thousands of servers

• DB2 installation flexibility for the location of binaries

• DB2 SMS file security preventing public and some DBA access

• DB2 SQL Alter Table command for DBA controlled column placement• DB2 Optional Logging by turning it off

• DB2 stored procedure complier needs to be optional • DB2 encryption and security

• DB2 Unicode compatibility between all platforms of the DB2 family

Also, Mr. Dan Nieman (479-277-3664) asked if there are any best practices as to getting around these issues. This document will address the requests of both Alan and Dan.

Getting Started

The best practices outlined in this paper compiles methods and recommendations for developing better, more maintainable DB2 /UDB applications and avoiding oversights in managing a DB2 UDB installation.

The source code in this paper allows you to scan the DB2 instance either locally or remotely, provided you have the administrative privileges for each DB2 server you want to scan. Note that some activities require sysadmin privileges in DB2, while others require machine administrator privileges. The project plan at the close of this document gives some direction to follow over the next six weeks to address in the near term the issues raised by both Alan and Dan.

Federated/Nickname limitations

A federated system is composed of a DB2 DBMS (the federated database) and one or more data sources. Data sources are identified to the federated database when you issue CREATE SERVER statements. When you issue these statements, you can also provide server options that refine and control aspects of federated system operations involving DB2 and the specified data source. Server options can be changed later using ALTER SERVER statements.

As for data types within Documentum (ECM), ensure that the local data type of a column does not prevent a predicate from being evaluated at the data source. The default data type mappings are provided to avoid any possible overflow. However, a joining predicate between two columns of different lengths might not be considered at the data source whose joining column is shorter, depending on how DB2 binds in the longer column. This situation can affect the number of possibilities in a joining sequence evaluated by the

Page 2 of 39

Page 7: Wal Mart Problem Analysis

DB2 optimizer. This is to say we can use the Alter SERVER options and the Alter NICKNAME commands to adjust the selected tables as needed. Coupled with a “perl” script for UNIX and parameterized “.bat” file scripts for MS Windows, we can adjust hundreds of table changes monthly.

IBM Resources:

Federated Query Performance Expert

Susanne EnglertEmail: [email protected]: 1-408-463-2329Cell phone: 1-408-674-0687Location: San Jose, CA, USA

See also: IBM Federated Database Technologyhttp://www-106.ibm.com/developerworks/db2/library/techarticle/0203haas/0203haas.html

DB2 Database Management With a multiple ERP environment planned at Wal-Mart, the best solution would be to define a stand-alone database instance for each ERP used. With each upgrade of a given ERP, the applications setup program will change its database configuration parameters to suit its needs. We can separate out these adjustments and still apply DB2 maintenance by using the technique of separate instances for each ERP. However, if Wal-Mart would like to keep a single instance for all its EPR’s applications, IBM has a DB2 object comparison tool that will automatically synchronize test and production as to the configuration changes on all selected platforms.

On HP Unix, we would need to develop scripts that will keep the DB2 test and production catalogs synchronized by keeping version files for comparison, this would provide increased flexibility of changing in one place all of the changes needed to synchronize the DB2 system catalogs. The method would account for the intentional differences and/or naming discrepancies between any number of objects. Lastly, the script would generate target changes into a work statement list that can be propagated to remote sites.

IBM Resources:

IBM DB2 Automated Computing Project

Jessica (J. E.) ScottEmail: [email protected] Email: ([email protected])Telephone: 1-905-413-3108Location: Markham, ON, Canada

IBM DB2 Object Comparison Tool Support

Patrick J. (Pat) FraciscoEmail: [email protected]: 1-415-545-2186Location: San Francisco, CA, USA

See also: IBM DB2 Object Comparison Tool for z/OS, Version 2http://www-306.ibm.com/software/data/db2imstools/html/db2objcomparev2.html

Unicenter® Database Analyzer® Release 3.0 for DB2http://www3.ca.com/Files/DataSheets/uni_db_analyzer.pdf_r3.0_for_db2.pdf

DB2 Space Management

With Veritas for DB2 edition you can assign a raw device and size it as needed for any DB2 object. Veritas has an integrated suite of data and storage-management products that optimize performance and availability of DB2 server databases. This tool set delivers rapid file system recovery, online storage management, and

Page 3 of 39

Page 8: Wal Mart Problem Analysis

simplified administration. The Veritas Database Edition leverages Wal-Mart’s hardware and software resources to maintain high speed performance and data integrity with the administrative ease of traditional file systems. It also allows the breaking of the 2GB barrier for the 32 bit version of DB2. It has the following advantages of:

• Easy management • Space pre-allocation is not required • Table space growth is possible by growing the data files up to the limit of the file system• Table space growth is possible by adding new containers

In general, small personal databases are easiest to manage with SMS table spaces. If you choose to use DMS table spaces with device containers, you must be prepared to tune and administer your environment. However, with Veritas you are a lot closer to the idea of a “dbspace” command for DB2.

IBM Resources:

IBM Global Sales Support Consultant

Paul (P.C.) ZikopoulosEmail: [email protected] Email: [email protected] Telephone: 1-905-413-2572Location: Markham, ON, Canada

See Also: DB2 Universal Database and the Highly Available Data Storehttp://www-106.ibm.com/developerworks/db2/library/techarticle/0310melnyk/0310melnyk.html Varitas for DB2 http://eval.veritas.com/downloads/van/3283.pdf

DB2 Database Upgrade and Patches

At this time DB2 only offers a limited solution to rolling out upgrades to thousands of servers. The list below represent the knowledge required by any given software installation. The descriptions are managed in six steps that make up the autonomic software deployment process. In the DB2 world, the manual software deployment steps evolve to become:

• Package—Create an installable unit with dependencies identified

• Analyze—Check all dependencies and identify updates required

• Plan—Specify targets, migration paths, and configuration changes

• Install—Define installation capabilities in a common format

• Configure—Share configuration details across components

• Verify—Validate installation success and component behavior

With Microsoft Systems Management Server (SMS), you can install DB2 products across a network onto remote Windows systems, setting up the installation from a central location. You can also uninstall windows based software. You would simply choose to uninstall DB2 products.

To install DB2 products via SMS, perform the steps in the following sections:

• Step 1. Make DB2 Files Available for Installation • Step 2. Create a Response File for Unattended Installation

Page 4 of 39

Page 9: Wal Mart Problem Analysis

• Step 3. Import the DB2 Install Files into SMS • Step 4. Distribute the DB2 Installation Package Using SMS • Step 5. Run the Installation on the SMS Client

IBM Resources:

Mr. Michael (X.M.) Gao

IBM DB2 UDB ConsultantEmail: [email protected]: 1-905-413-5734Location: Markham, ON, Canada

See also: DB2 large scale rollout of DB2 http://www-106.ibm.com/developerworks/db2/library/techarticle/0302gao/0302gao.html Microsoft Systems Management Server (SMS) http://www.microsoft.com/smserver/

DB2 installation flexibility of location of binaries

The inability to install DB2 for AIX in a location other than /usr/lpp is an operating system restriction. Currently, this cannot be overridden on AIX. However, on Sun Solaris and HPUX both provide this option, so DB2 on those systems has the ability to specify a different directory path during installation.

If faced with space limitations, you might want to consider mounting a filesystem at the DB2 install location (i.e., /usr/lpp/db2_08_01) prior to the DB2 installation. You can also try doing a symbolic link on the /usr/lpp/ install path to a path with more space.

To install UDB in another filesystem, a symbolic link can be created between /usr/lpp/DB2_08_00 and the directory where you really want the installation.

For example use the command,

ln -s /usr/lpp/DB2_08_01 /your-directory/DB2_08_01.

In this way you can install DB2 in any directory you wish.

IBM Resources:

IBM DB2 UDB Consultant

Mr. Shelton ReeseEmail: [email protected] Email: [email protected]: 1-312-635-0198Location: Chicago, IL USA

DB2 SQL Alter Table command for user controlled column placement

The ALTER TABLE … ADD COLUMN statement can be used from within an application. However, for temporary usage of additional columns, temporary tables or tables created with DECLARE GLOBAL TEMPORARY TABLES statement are more appropriate, since this data can be dropped within the same application or session. Especially declared global temporary tables will yield top rated performance, since there aren’t any updates to the DB2 catalog.

Following is a workaround for the problem of wanting to insert a column into the middle of a table:

A view, which is defined as the join of the base table and the temporary table that contains the new column

Page 5 of 39

Page 10: Wal Mart Problem Analysis

(and some join columns), would allow the application to refer to the view as it would be the base table added with another column. To be more precise: if a table MYTABLE should be complemented with a column NEWCOLUMN, a temporary table TEMPTABLE should be created that consists of this new column. In addition, the TEMPTABLE should also contain the column(s) of MYTABLE that should be used for the join of these 2 tables.

DECLARE GLOBAL TEMPORARY TABLE TEMPTABLE(COLUMN_1 INT NOT NULL, NEWCOLUMN CHAR) IN MYTABLESPACE …

In the above statement, COLUMN_1 is used as the join column with the base table. Following is the definition of the view:

CREATE VIEW MYVIEW AS SELECT X.COLUMN_1, X.COLUMN_2, … , Y.NEWCOLUMNFROM MYTABLE X, TEMPTABLE YWHERE X.COLUMN_1 = Y.COLUMN_1

It should be mentioned that declared global temporary tables couldn’t be used in a CREATE INDEX statement.

So the workaround is based on the usage of temporary or declared global temporary tables in conjunction with a view definition, and not through modifying the base table itself.

IBM Resources:

IBM DB2 UDB Consultant

Mr. Shelton ReeseEmail: [email protected] Email: [email protected]: 1-312-635-0198Location: Chicago, IL USA

DB2 Optional Logging by turning it off

“No logging” is essentially a DB2 implementation. It makes little sense to bypass logging. IBM DB2 has greatly improved the logging rates. Since the new ESS models, there are more than 20 megabytes/second for dual level logging with striping more than 30 m/s. With performance at these levels, the risks associated with bypassing logging far outweigh any possible benefits.

IBM now has 5 mechanisms in place to reduce logging rates — LOAD, work files, created global temporaries, declared global temporaries and LOBs. If the objective is to save space on the log and archiving, there are a number of techniques for doing that. One example is compressing the archive log with a tool from IBM. If the objective is to improve overall performance or elapsed time by 10%, turning off logging generally cannot do that. It does make recovery more troublesome and does affect the concurrency. DB2 has options to turn off logging when the lack of logging doesn’t compromise data and subsystem integrity. They include:

• LOAD utility: LOG NO does not turn off all logging, but does avoid logging the data, and ensures a good commit frequency. If the volume to be inserted is very high and concurrency is not required, then using the LOAD utility is what I’d suggest.

Page 6 of 39

Page 11: Wal Mart Problem Analysis

• For an intermediate step in performance LOAD RESUME SHRLEVEL CHANGE provides higher performance than INSERT, but it still logs.

• Work files: No logging is needed. There are no recovery or restart issues.

• Global temporary tables - These tables have no logging, recovery or restart problems. The global temporary tables are empty at each new unit of work.

• Declared temporary tables - These tables can have indexes and updates with rollback, so undo logging is done (but not the data for inserts with redo logging). These tables are empty when the thread terminates, so recovery is not an issue.

• LOBS: LOG NO is an applicable option, while we have the information required for restart and recovery in other places. If you are storing images and video, this is probably the technique you will use to avoid logging.

Beyond the current capabilities, there are a number of requirements that ask about turning off logging. The key question is how you expect to handle your COMMIT, ROLLBACK, transaction atomicity, statement atomicity, checkpoint, restart, and any error situations. Without a log, we lose some of the ACID (atomicity, consistency, isolation and durability) properties that make DB2 a database.

There are some risks and changes for turning off logging. Some are similar to cancel with no rollback. If anything goes wrong, your data is trash. Drop the tables and start over. DB2 uses the log for statement atomicity, index and data matching, referential integrity errors, and several other purposes. There is a substantial amount of code to be reworked or the function will have restrictions. The biggest performance problem with not logging is that we’ll need to write the data more often and force all of the data and indexes to disk, waiting at commit. This is likely to result in less concurrency and longer response times for transactions that log.

The performance of some DBMSs is significantly better if logging is turned off. The DB2 high volume log writes are done asynchronously. For transactions with high commit rates, DB2 can use one set of log writes for many transactions. DB2 IO optimization generally means that the improvement for avoiding logging, even for an image application, is 5% or less. If there are a few megabytes to insert, the log writes take a fraction of a second. There are situations where the log can become a performance constraint. The DB2 logging rate is above 100 GB per day. Benchmarks with the first Enterprise Storage Server (ESS) and dual logs were measured at about 8 MB per second or about 28 GB per hour. That’s for a single member of a data sharing group, so the logging rate for a group is several times larger. VSAM striping can be used on each member to improve the logging rates by another factor. With FICON and ESS model 800, logging rates can easily exceed 100 GB per hour per member of a data sharing group. Another reason for wanting to avoid logging is to improve recovery times. We have many options that range from improved speed of log files to disk using functions like FlashCopy to improve recovery times.

IBM Resources:

IBM DB2 UDB Consultant

Monty WrightEmail: [email protected]: 1-972-280-1388Location: Roanoke, TX, USA

See also: An Overview of High Availability and Disaster Recovery for DB2 UDBhttp://www-106.ibm.com/developerworks/db2/library/techarticle/0304wright/0304wright.html

Page 7 of 39

Page 12: Wal Mart Problem Analysis

DB2 Stored Procedure compiler needs to be optional

This is a complaint of most MS VC++ users have with DB2 and AIX. An error occurs saying the object is not the right object “XCOFF” format. This error is due to the fact that the default compiler, which is the Microsoft compiler, is being used and you don’t have the MS compiler installed, you most likely have the IBM compiler. In any case, the compiler choice is set by commenting or uncommenting the file sqllib\function\routine\sqlproc.mak.

Here is how to do it:

• locate the file on your drive;

• close down Visual Age Store Procedure Builder (SPB);

• terminate all active connections to your test database;for your test database, do a db2stop

• open the sqlproc.mak file and follow the instructions that are in the file;resave the file, check the OS to make sure that the file time has indeed changed;reopen the file and confirm that the selection you made is active; if the change has not been made, set the file’s attribute to A and resave the file;

• restart the DB2 instance with the command >db2start;reopen SPB and rebuild the procedure, it should build OK now;

• once the stored procedure has been built and tested, use the DB2 get routine command to generate the “sar” file, then use the put routine command to distribute it.

The compiler path variable refers to the batch file that sets up your development environment. If you can compile C or C++ programs already, your development environment is already correctly set up. The problem is with your compiler path variable; it is pointing to the wrong file. The batch file you want to use typically includes SET variables and is most commonly found in the \bin directory for the compiler product you are using. So, check in your directories that contains the development environment for these types of files and reset the path to that file and try again.

IBM Resource:

Peggy M. RaderSenior Software EngineerEmail: [email protected] Phone: [email protected]: IBM Silicon Valley Lab in San Jose, CA, USA

See Also: Debugging Options for DB2 UDB Stored Procedureshttp://www-106.ibm.com/developerworks/db2/library/techarticle/0310rader/0310rader.html

DB2 encryption and securityAt a high-level, DB2 security adds a WHERE clause predicate to every SQL statement that is issued on behalf of an individual and user. Depending upon the end user’s access, the WHERE clause constrains information to specific rows within the table, hence the name row-level security.

But we can also do row-level security with views. It is possible to restrict SELECT access to individual rows and columns within a relational table. For example, assume that a person table contains confidential columns such as SALARY. Also assume that this table contains a TYPE column with the values EXEMPT, NON_EXEMPT and MANAGER. We want our end-users to have access to the person table, but we wish to restrict access to the SALARY columns and the MANAGER rows. A relational view could be created to isolate the columns and rows that are allowed:

Page 8 of 39

Page 13: Wal Mart Problem Analysis

create view finance_view as

select name, address

from person

where department = ‘FINANCE’;

We may now grant access to this view to anyone:

grant select on FINANCE_VIEW to Jamison;

Let’s take a look at how DB2 works. When users access a table (or view) that has a security policy:

1. DB2 calls the policy function, which returns a “predicate.” A predicate is a WHERE clause that qualifies a particular set of rows within the table. The heart of DB2 security is the policy transformation of SQL statements. At runtime, DB2 produces a transient view with the text:

SELECT * FROM Jamison.emp WHERE P1

2. DB2 then dynamically rewrites the query by appending the predicate to the users’ SQL statements. The methodology is used widely for DB2 systems on the Web, where security must be maintained according to instantiated users, but at the same time provide a method whereby the data access can be controlled through more procedural methods. Please note that this approach to DB2 security requires the use of SQL/SP functions to define the security logic.

There are several benefits to DB2 security:

• Multiple security — You can place more than one policy on each object, as well as stack highly- specific policies upon other base policies.

• Good for Web Apps — In Web applications, a single user often connects to the database. Hence, row-level security can easily differentiate between users.

• No back-doors — Users no longer bypass security policies embedded in applications, because the security policy is attached to the data.

To understand how this works, let’s take a closer look at the emp_sec procedure below. Here we see that the emp_sec function returns an SQL predicate, in this case “ENAME=xxxx,” in which XXX is the current user (in DB2, we can get a current user ID by calling the USER function). This predicate is appended to the WHERE clause of every SQL statement issued by the user when they reference the EMP table.

CREATE OR REPLACE FUNCTION

emp_sec (schema IN varchar2, tab IN varchar2)

RETURN VARCHAR2 AS

BEGIN

RETURN

‘ename=””

||

USER(

‘userenv’,

Page 9 of 39

Page 14: Wal Mart Problem Analysis

‘session_user’) || “””;END emp_sec;

/Once the function is created, we call the dbms_rls (row-level security) package. To create a security policy, we invoke the add_policy procedure, where the policy definition is controled from a central point.

IBM Resources:

Dwaine R. Snow

Email: [email protected] UDB and Informix Product Manager, IBM Toronto LabRaul (R.F.) ChongEmail: [email protected]: 1-905-413-2334Location: Markham, ON, Canada

See Also: Preventing Public Access to the DB2 Database http://www.databasejournal.com/features/db2/article.php/10896_3075671_2

DB2 Unicode compatibility between all platforms of the DB2 family

This always tends to be a configuration issue. The definition of DB2 UNICODE APIs is UCS-2 (UTF-16) WCHAR character strings, not UCS-4(UTF-32). This is independent of the operating system. Since the size of a WCHAR is UCS-4 (UTF-32) on HP-Unix, all strings will need to be converted from UCS-4 to UCS-2 or use informational components for unicode (ICU), which is a third party library written by IBM but currently available as open source. To be considered a Unicode application, the application must set the SQL_ATTR_ANSI_APP connection attribute to SQL_AA_FALSE before a connection is made. This will ensure that CLI will consider Unicode the preferred method of communication between itself and the database.

ODBC adds types to the set of C and SQL types that already exist to accommodate Unicode, and CLI uses these additional types accordingly. The new C type, SQL_C_WCHAR, indicates that the C buffer contains UCS-2 data in native-endian format. The new SQL types, SQL_WCHAR, SQL_WVARCHAR, and SQL_WLONGVARCHAR, indicate that a particular column or parameter marker contains Unicode data. For DB2 Unicode databases, graphic columns will be described using the new types. Conversion will be allowed between SQL_C_WCHAR and SQL_CHAR, SQL_VARCHAR, SQL_LONGVARCHAR and SQL_CLOB, as well as with the graphic data types.

Obsolete CLI/ODBC Keyword Values Before Unicode applications were supported, applications that were written to work with single-byte character data could be made to work with double-byte graphic data by a series of DB2 CLI configuration keywords, such as GRAPHIC=1,2 or 3, Patch2=7. These workarounds presented graphic data as character data, and also affected the reported length of the data. These keywords are no longer required for Unicode applications, and should not be used due to the risk of potential side effects. If it is not known if a particular application is a Unicode application, I suggest you try without any of the keywords that affect the handling of graphic data.

Literals in Unicode Databases In non-Unicode databases, data in LONG VARGRAPHIC and LONG VARCHAR columns cannot be compared. Data in GRAPHIC/VARGRAPHIC and CHAR/VARCHAR columns can only be compared, or assigned to each other, using explicit cast functions since no implicit code page conversion is supported. This includes GRAPHIC/VARGRAPHIC and CHAR/VARCHAR literals where a

Page 10 of 39

Page 15: Wal Mart Problem Analysis

GRAPHIC/VARGRAPHIC literal is differentiated from a CHAR/VARCHAR literal by a G prefix. For Unicode databases, casting between GRAPHIC/VARGRAPHIC and CHAR/VARCHAR literals is not required. Also, a G prefix is not required in front of a GRAPHIC/VARGRAPHIC literal. Provided at least one of the arguments is a literal, implicit conversions occur. This allows literals with or without the G prefix to be used within statements that use either SQLPrepareW() or SQLExecDirect(). Literals for LONG VARGRAPHICs still must have a G prefix.

For more information about ICU, check International Components for Unicode.

IBM Resources:

Helen (H.S.) ShihEmail: [email protected]: 1-905-316-6879Location: Markham, ON, Canada

Markus SchererEmail: [email protected]: 1-408-256-3109Location: San Jose, CA, USA

See Also: Introduction to IBM classes for Unicodehttp://www-106.ibm.com/developerworks/java/library/j-unicode.html

Next Steps for DB2

Date Who What When Why Benefit Risk7/22/2004 IBM Handover to

new DB2/dba2 days S. Reese is

the short term resource for Wal-Mart

High None

7/23/2004 IBM DBA DB2 Status Check

Monthly All Databases should be check for table usage and backup verifications

High Low

7/26/2004 IBM DBA

Dan Nieman

Design of Federated Database Server options and Nicknames

1 Week Federated Database Design as to Data need and investigated ERP access paths

High Low

8/02/2004 IBM DBA

Dan Nieman

ERP instance setup and DBM

1 Week HP Unix and AIX scripts are

High Medium

Page 11 of 39

Page 16: Wal Mart Problem Analysis

configuration needed to synchronize db2 system catalogs

08/09/2004 IBM DBA Investigate Veritas for DB2 Space Management

1 Week Wal-Mart would like to have the flexibility of assigning Raw/IO when creating VLDB’s

High Low

08/16/2004 IBM DBA DB2 Planning for upgrading and patches of ERP software

2 weeks

Wal-Mart needs to know precisely how the DB2 software will be deployed to thousands of servers

High None

8/16/2004 IBM DBA

Dan Nieman

Select the install locations for all DB2 binaries at Wal-Mart

1 week Wal-Mart needs to specify were it wants DB2 installed

High medium

8/23/2004 IBM DBA DB2 Logging standards

2 weeks

Setting a standard for where and how logging would be turned OFF

High Low

8/30/204 IBM DBA

Application Development

Adjust the sqlproc.mak files

1 week Applications staff need to connect to the right compiler when creating SP’s even when using Visual Age

High medium

Page 12 of 39

Page 17: Wal Mart Problem Analysis

SP Builder9/7/2004 IBM DBA

Dan Nieman

DB2 row level security design and DB2 column encryption usage

1 week Wal-Mart needs to design their row level security in conjunction with the ERP applications’ user access policies.

High Low

9/13/2004 IBM DBA DB2 Unicode implementation

1 week Wal-Mart needs to check the cli files and ERP settings to set the proper Unicode for AIX and then for HP-UX

High Medium

Appendix A

As noted in the WIRE database health check document a number of default settings will need to be updated. I have created a job written in PERL script to update the database configuration as suggested in the WIRE Report. It also runs database statistics, database reorganization checking and checks for database consistency. I’ve also installed on the CD-ROM and on the HOTSTI01 sever and in the “/common/dba/db2/scripts” directory a kron shell script named “db2chk.ksh” that will analyze any selected DB2 database and perform a real time health check for any Wal-Mart selected DB2 system. This action is needed because as more data, application activity or new ERP applications come into play the database will need to be monitored and adjusted to handle the workload.

Lastly, I’ve attach the results of the OW_DEV database health check which is a 64-bit DB2 8.1.4 database using the new tool provided to Wal-Mart. This health check script written in “kron shell” has been tested on a number of Wal-Mart databases.

IBM Resource: IBM DB2 UDB Consultant

Page 13 of 39

Page 18: Wal Mart Problem Analysis

Mr. Shelton ReeseEmail: [email protected]

Alternate Email: [email protected]

Telephone: 1-312-635-0198Location: Chicago, IL USA

Best practices for tuning DB2 UDB v8.1 and its databaseshttp://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0404mcarthur/

#*********************************************************************##*(c) Copyright IBM Corp. 2004 All rights reserved. *##* *##*This sample program is owned by International Business Machines *##*Corporation or one of its subsidiaries ("IBM") and is copyrighted *##*and licensed, not sold. *##* *##*You may copy, modify, and distribute this sample program in any *##*form without payment to IBM, for any purpose including developing, *##*using, marketing or distributing programs that include or are *##*derivative works of the sample program. *##* *##*The sample program is provided to you on an "AS IS" basis, without *##*warranty of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL *##*WARRANTIES EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO*##*THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTIC-*##*ULAR PURPOSE. Some jurisdictions do not allow for the exclusion or *##*limitation of implied warranties, so the above limitations or *##*exclusions may not apply to you. IBM shall not be liable for any *##*damages you suffer as a result of using, modifying or distributing *##*the sample program or its derivatives. *##* *##*Each copy of any portion of this sample program or any derivative *##*work, must include a the above copyright notice and disclaimer of *##*warranty. *##* *##*********************************************************************##*********************************************************************##* This script updates the necessary db2 Database Manager and active *# #* database parameters it will also perform various system commands *##* on db2 improve performance. *##* Usage : perl db2_config_update.pl <dbname> *##*********************************************************************#

if (@ARGV > 0){

$dbname=$ARGV[0]; system("db2 connect to $dbname "); system("export EXTSHM=ON "); system("db2set db2ENVLIST=EXTSHM "); printf("DB2 Configuration Update Started... \n"); system("db2iauto -on $db2inst > db2cfgupt.log"); system("db2 force applications all >> db2cfgupt.log"); #* Database global memory #* Memory required for a database to run. This memory is allocated when #* the database gets activated. The number of memory segments is #* limited by the numdb (number of databases) configuration parameter. #* The total size of database global memory is determined by the database

Page 14 of 39

Page 19: Wal Mart Problem Analysis

#* configuration parameters updated below: system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING LOCKLIST 2275 >> db2cfgupt.log"); system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING UTIL_HEAP_SZ 65822 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING DBHEAP 80000 >> db2cfgupt.log"); #* Application global memory #* Application global memory is the memory required for the application #* to run. This memory is allocated when the first agent to receive a #* request from the application requests a connection. This memory is #* controlled by the database configuration parameter app_ctl_heap_sz. #* Application global memory is shared between all agents working for #* the same application. #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING APP_CTL_HEAP_SZ 184 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING APPGROUP_MEM_SZ 17843 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING CATALOGCACHE_SZ 2048 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING CHNGPGS_THRESH 60 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING LOGBUFSZ 4096 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING LOGFILSIZ 20000 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING LOGPRIMARY 20 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING LOGSECOND 5 >> db2cfgupt.log"); #* Agent private memory #* Each agent has its own private memory. The lower of the configuration parameters maxappls and #* maxagents limits the number of memory segments #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING MAXAPPLS 465 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING MAXLOCKS 48 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING MINCOMMIT 1 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING NUM_IOCLEANERS 2 >> db2cfgupt.log"); system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING NUM_IOSERVERS 3 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING PCKCACHESZ 4096 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING SOFTMAX 120 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING SORTHEAP 2048 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING STMTHEAP 11776 >> db2cfgupt.log"); system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING DFT_DEGREE -1 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING DFT_PREFETCH_SZ 32 >> db2cfgupt.log"); #* Agent/application shared memory

Page 15 of 39

Page 20: Wal Mart Problem Analysis

#* This memory is shared between the agents that are working for the same application. #* system("db2 UPDATE DATABASE CONFIGURATION FOR $dbname USING STAT_HEAP_SZ 5700 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING SHEAPTHRES 28192 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING INTRA_PARALLEL ON >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING MAX_QUERYDEGREE 7 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING MAXAGENTS 2884 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING NUM_POOLAGENTS 2884 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING NUM_INITAGENTS 5 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING FCM_NUM_BUFFERS 1024 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING RQRIOBLK 32767 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING QUERY_HEAP_SZ 16000 >> db2cfgupt.log"); system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING MON_HEAP_SZ 1024 >> db2cfgupt.log"); #* system("db2 UPDATE DATABASE MANAGER CONFIGURATION USING JAVA_HEAP_SZ 2048 >> db2cfgupt.log"); system("db2 terminate >> db2cfgupt.log"); system("db2 connect to $dbname >> db2cfgupt.log"); printf("DB2 Database: $dbname Update Started... \n") system("db2 connect to $dbname;db2 SET CURRENT QUERY OPTIMIZATION = 5 >> db2cfgupt.log"); printf("db2 COMMIT \n"); printf("db2 CONNECT RESET \n"); system("db2 terminate >> db2cfgupt.log"); printf("DB2 System Reorgaization Started... \n"); system("db2 connect to $dbname;db2 REORGCHK UPDATE STATISTICS ON TABLE ALL >> db2cfgupt.log"); system("db2ckmig $dbname -l db2migchk.txt >> db2cfgupt.log"); printf("DB2 Rebind Started... \n"); system("db2rbind $dbname -l db2rebind.txt all >> db2cfgupt.log"); sleep(4); system("db2stop force >> db2cfgupt.log"); sleep(4); printf("DB2 Restarted... \n"); system("db2start >> db2cfgupt.log"); printf("DB2 Configuration and Database: $dbname Updated. \n");

Page 16 of 39

Page 21: Wal Mart Problem Analysis

Monitoring Database OW_DEV for 30 secondsMon Jul 19 15:13:54 CDT 2004

DB20000I The UPDATE MONITOR SWITCHES command completed successfully.

Database Connection Information

Database server = DB2/AIX64 8.1.4 SQL authorization ID = UDBDBA Local database alias = OW_DEV

DB20000I The UPDATE MONITOR SWITCHES command completed successfully.

MONITORING THE BUFFER POOL

Buffer Pool and Index Pool Hit Rate - the higher, the better===================================Buffer pool data logical reads = 1248474Buffer pool data physical reads = 83574Buffer pool index logical reads = 1871400Buffer pool index physical reads = 57253

Buffer Pool Hit Rate = 95.49 %Buffer Pool Data Hit Rate = 93.31 %Buffer Pool Index Hit Rate = 96.94 %

Impact of Prefetchers=====================Number of I/O servers (prefetchers) = 1

Sequential Detect Flag = NOIf sequential detect is set to NO, prefetching takes place only if thedatabase manager determines it will be useful for table sorts, tablescans or list prefetch. If it is set to YES, prefetching will occurwhenever the database manager detects sequential page reading.

Default Prefetch Size (4KB) = 0 (0 bytes)Default Tablespace Extentsize (4KB) = 0 (0 bytes)The default prefetch/extent size is only used for a tablespace ifPREFETCHSIZE/EXTENTSIZE was not specified during CREATE TABLESPACE.The prefetchsize and extentsize together determine the amount ofprefetching that will be done for a tablespace.

The following hit rate does not include data read by the prefetchers.If this is much higher than the buffer pool hit rate (above), theprefetchers may be causing inefficiencies.

Asynchronous pool data page reads = 40328Asynchronous read requests = 0Buffer Pool Hit Rate (excluding prefetched data) = 96.78 %

The following ratio helps determine how much I/O was doneby the prefetchers per interaction:

Page 17 of 39

Page 22: Wal Mart Problem Analysis

Average number of data pages read per prefetcher request = 0

Other Buffer Statistics=======================The following average read time should not increase significantly as youtune the buffer pool.

Average Synchronous I/O read time = 0.11 ms

Buffer Pool pages are written to disk - to free a page in the buffer pool so another data page can be read, or - to flush the data pool.It may be possible to increase the ratio of reads to writes by increasingthe size of the buffer pool. Refer to the ratios below.Buffer pool data writes = 10492Buffer pool index writes = 6374

Buffer Pool Data Physical Reads/Physical Writes = 796.55 %Buffer Pool Index Physical Reads/Physical Writes = 898.23 %

Asynchronous Page Cleaners==========================Changed pages threshold = 60 %This threshold specifies the percentage of changed pages at whichthe asynchronous page cleaners will be triggered.Dirty Page Threshold Cleaner Triggers = 11873

No. of Page Cleaners = 30Query-only databases do not require page cleaners. Large buffer poolsand large numbers of disks typically require more page cleaners.

Buffer pool data writes = 10492Asynchronous pool data page writes = 9784Percentage of data page writes carried out by page cleaners = 93.25 %

Buffer pool index writes = 6374Asynchronous pool index page writes = 6049Percentage of index page writes carried out by page cleaners = 94.90 %

If most writes are not being carried out by the page cleaners (see above),increase NUM_IOCLEANERS (the number of page cleaners). In general, themore writes done by the page cleaners the better, although if pagesare cleaned too vigorously, you may be unnecessarily flushing pagesthat will soon be dirtied again.Dirty Page Steal Cleaner Triggers = 1954The page cleaners will be triggered when an agent steals a dirty pagebecause the page cleaners are not keeping up with demand.

LSN Gap cleaner triggers = 7028The page cleaners will be triggered if SOFTMAX (the LSN gap) is exceeded.

Sorts=====

Page 18 of 39

Page 23: Wal Mart Problem Analysis

Sort List Heap (4KB) = 4096 (16777216 bytes)Sort List Heap defines the max no. of private memory pages to be used foreach sort. This memory is deallocated after use. Bigger is usually better.

Sort Heap Threshold (4KB) = 40000 (163840000 bytes)Sort Heap Threshold is not a hard limit, but if it is exceeded, the faster"pipe" sorts will not be performed. The threshold impacts the total amountof memory that can be allocated for all concurrent sort heaps.In general, the more Sort Heap Threshold memory the better.

Active Sorts = 0Total Sort Heap Allocated = 0Total Sort Time (ms) = 0Total Sorts = 5252Average elapsed time per sort = 0.00 msSorts requiring merge phases = 0.13 %i.e. started as piped sort, but required more memory than allocated.

Post Threshold Sorts = 0

Piped Sorts Requested = 1571026Piped Sorts Accepted = 1571026Piped Sorts Serviced = 100.00 %

Index Sort Flag = YESThe Index Sort Flag determines whether or not sorting of index keyswill occur during index creation. Index creation will perform betterby doing a sort first.

Lock Information================Interval for Checking Deadlock (ms) = 1000A long deadlock checking interval means less frequent checks and thereforeless system time, but also a longer wait for deadlocked applications.Deadlocks Detected = 0

Lock Timeout Interval (sec) = 60A locktimeout of -1 means lock timeout detection is turned off.Lock Timeouts = 0

The interval for deadlock checking should be less than the lock timeoutinterval, so deadlocks are eliminated before locks, that might besuccessfully received, are rolled back.

Percent. of Lock Lists per Application = 10This parameter defines a percentage of the lock list that must befilled by a connected process before DB2 performs lock escalation.

Max Storage for Lock Lists (4KB) = 0 (0 bytes)If the lock list is too small, lock escalation can result.Lock list memory in use (Bytes) = 8512 bytesLock Escalations = 0

Page 19 of 39

Page 24: Wal Mart Problem Analysis

Exclusive Lock Escalations = 0

Locks Held Currently = 9Current Applications Waiting on Locks = 0

Lock waits = 66Time database waited on locks (ms) = 521Average wait time per lock = 7.89 ms

Logging=======Log Retain for Recovery Enabled = OFFLog File Size (4KB) = 2000 (8192000 bytes)Number of Primary Log Files = 10Number of Secondary Log Files = 20The Log File Size applies to each log file. The primary log files arepreallocated (although for raw logs, only the first 8K is allocated).If logretain is in use, a new primary log is allocated whenever a logfile switch takes place. For circular logging, the existing primarylogs are reused, and secondary logs are only allocated if the primarylogs prove temporarily insufficient.Secondary Logs Allocated Currently = 0

Log pages read = 0Log pages written = 39494Max Total Log Space Used = 21381989 (20 MB) = 2.6 log files

Log Buffer Size (4KB) = 512 (2097152 bytes)

Group Commit Count = 1The Group Commit Count determines how many commits will be written tothe log file at one time. The writing of log records to disk will bedelayed until the count is reached or 1 second elapses. The use ofgroup commit improves logging efficiency, sometimes at the cost oftransaction delays. A setting of 3 may be a good starting point fora busy system.

Commit statements attempted = 10366Rollback statements attempted = 3556

Percent log file reclaimed before soft chckpt = 100 %SOFTMAX fulfills two distinct purposes. Firstly, it determines howfrequently the log control files are flushed to disk. This occurswhen softmax percentage of one log file is reached. Secondly, it determineswhen the page cleaners are triggered based on LSN gap. This occurs whensoftmax percentage of the total primary log file space is reached.In general, a smaller softmax means a shorter recovery time.

MONITORING OTHER STATISTICS===========================Database heap (4KB) = 10000 (40960000 bytes)High water mark for database heap (4KB) = 0 (0 bytes)

Catalog Cache Statistics

Page 20 of 39

Page 25: Wal Mart Problem Analysis

Catalog Cache Size (4KB) = 64 (262144 bytes)Catalog Cache Inserts = 2105Catalog Cache Lookups = 21396

Catalog Cache Miss Rate = 9.84 %

Catalog Cache Overflows = 0Catalog Cache Heap Full = 0

If the Catalog Miss Rate shown above is not small (less than 20 %), or ifthe number of Overflows is high, try increasing the Catalog Cache Size.If the Heap Full count is high, increase dbheap or decrease catalogcache_sz.

A large number of DDL statements can adversely affect the performanceof the catalog cache:DDL SQL Statements = 0

Utilities Heap Size (4KB) = 5000 (20480000 bytes)

Recovery, Load and Other Utilities==================================The Utilities heap is used by the backup, restore, load and load recoveryutilities and is the maximum amount of memory that can be usedsimultaneously by these utilities. It is also related to:

Backup Buffer Default Size (4KB) = 1024 (4194304 bytes)Restore Buffer Default Size (4KB) = 1024 (4194304 bytes)

These values are used if the buffer size on the backup/restore commandsare set to 0. Recommendation: use buffer-size and num-buffers on thecommand instead. More smaller buffers are better than a few large buffers.

Auto Restart Enabled = ONWhen set on, the database manager automatically calls the restartutility if needed.

Index Re-creation Time = RESTART Indicates when the database manager will attempt to rebuild invalidindexes.

Default Number of Loadrec Sessions = 1Specifies the default number of sessions to be used during recoveryof a table load. This setting can be overriden with the DB2LOADRECenvironment variable. The default number of buffers for load retrievalis twice the value of this parameter.

Recovery History Retention (days) = 366

SQL and Agent Private Memory============================SQL Statement Heap (4KB) = 2048 (8388608 bytes)SQL Statement Heap is only allocated as required. Increase if youencounter errors during compilation.

Page 21 of 39

Page 26: Wal Mart Problem Analysis

Default Application Heap (4KB) = 2048 (8388608 bytes)Application Heap is allocated per agent upon connect. Increase if youencounter application errors relating to application heap.Package Cache Size (4KB) = 2000 (8192000 bytes)The Package Cache is allocated per agent to cache static and dynamic SQLstatements for packages.

Package Cache Lookups = 172275Package Cache Inserts = 3166Package Cache Hit Rate = 98.16 %If the Package Cache Hit Rate is low, consider increasing the package cache.Note that DDL statements negatively impact the performance of the packagecache:DDL SQL Statements = 0

Query Heap Size (4KB) = 10000 (40960000 bytes)Application Support Layer Heap Size (4KB) = 15 (61440 bytes)The Query Heap should be at least 5 times the size of the ApplicationSupport Layer Heap. The initial query heap is set to the size of theapplication support layer heap, and after big queries, the query heapwill again be reduced to the size of the asl heap size.

Max Requester I/O Block Size (bytes) = 32767The Max Requester I/O Block Size supports remote database connections,and is allocated per remote connection. It also determines whether blockingcursor requests can be accepted or not. The acceptance rate of blockingcursor requests can be monitored at the application level.

Data Statistics===============Statistics Heap Size (4KB) = 4384 (17956864 bytes)The Statistics Heap is used by runstats when collecting statistics.

Number of Frequent Values Retained = 10This parameter determines the number of "most frequent values"collected when the WITH DISTRIBUTION option of runstats is used.Increasing this value increases the statistics heap requirements.

Number of Quantiles Retained = 20This parameter determines the number of quantiles that will becollected when the WITH DISTRIBUTION option of runstats is used.Increasing this value increases the statistics heap requirements.

Per Instance Tunables=====================Database Monitor Heap Size (4KB) = 10000 (40960000 bytes)Database Monitor Heap is required for monitoring, snapshots etc.

Directory Cache Support = YESThe Directory Cache reduces connect costs by caching directoryinformation related to the database, node and DCS directory files.

CPU speed (millisec/instruction) = 6.376647e-07The CPU speed parameter is used by the optimizer. Do not change it!

Page 22 of 39

Page 27: Wal Mart Problem Analysis

Application Concurrency=======================Max Number of Existing Agents = 400The max agents limits the total no. of agents that may connect to alldatabases for this instance.Agents Registered = 87High Water Mark for Agents Registered = 95

Max Number of Concurrent Agents = The max concurrent agents limits the total no. of agents that mayconcurrently execute a database transaction. The default is -1 (thesame as maxagents).The maximum number of concurrent agents determines the maximum numberof concurrently active users. Other users will have to wait for a tokento become available.Agents Waiting for a Token = 0High Water Mark for Agents Waiting for a Token = 0If there are agents waiting for a token, increase MAXCAGENTS unlessthere is a good reason not to.High water mark for connections = 0

Max Number of Idle Agents = 0Idle Agents = 65After all user connections are terminated, a pool of idle agents(as defined above) will be retained to speed up new connections.Note that only local clients use idle agents; remote clients do not.

Max Number of Active Applications = 5000Average Number of Active Applications = 1The ave. no. of active applications is used by the SQL optimizer toestimate how much buffer pool will be available at runtime for theapplication. Be conservative. Try setting it to the average number ofheavy query applications.Application Connects = 3543Applications Connected Currently = 7Appls. Executing in DB Manager Currently = 0Remote Connections = 19Remote Connections Executing in DB Manager Currently = 0Local Connections = 0Local Connections Executing in DB Manager Currently = 0

Max DB Files Open per Application = 100Tablespace containers are handled as files. Make sure this value isset high enough to cover the number of files each agent will need tohave open. Monitor the number of files closed (0 is good):Database Files Closed = 110

Keep DARI process = You can decide to keep DARI (stored procedure) processes after theDARI calls are complete, which improves performance. This flag willbe ignored if the max no. of DARI processes is set to 0.Max Number of DARI Processes = 0The default for max no. of DARI processes is -1 (the same as maxagents).

RAW DATA========

Page 23 of 39

Page 28: Wal Mart Problem Analysis

Database Snapshot

Database name = OW_DEVDatabase path = /u/udbsys/db2inst8/NODE0000/SQL00008/Input database alias = OW_DEVDatabase status = ActiveCatalog database partition number = 0Catalog network node name =Operating system running at database server= AIX 64BITLocation of the database = LocalFirst database connect timestamp = 07-12-2004 16:27:03.938952Last reset timestamp =Last backup timestamp =Snapshot timestamp = 07-19-2004 15:14:25.950122

High water mark for connections = 21Application connects = 3543Secondary connects total = 0Applications connected currently = 7Appls. executing in db manager currently = 0Agents associated with applications = 7Maximum agents associated with applications= 21Maximum coordinating agents = 21

Locks held currently = 9Lock waits = 66Time database waited on locks (ms) = 521Lock list memory in use (Bytes) = 8512Deadlocks detected = 0Lock escalations = 0Exclusive lock escalations = 0Agents currently waiting on locks = 0Lock Timeouts = 0Number of indoubt transactions = 0

Total Private Sort heap allocated = 0Total Shared Sort heap allocated = 0Shared Sort heap high water mark = 0Total sorts = 5252Total sort time (ms) = 8007Sort overflows = 7Active sorts = 0

Buffer pool data logical reads = 1248474Buffer pool data physical reads = 83574Buffer pool temporary data logical reads = 21Buffer pool temporary data physical reads = 0Asynchronous pool data page reads = 40328Buffer pool data writes = 10492Asynchronous pool data page writes = 9784Buffer pool index logical reads = 1871400Buffer pool index physical reads = 57253Buffer pool temporary index logical reads = 0Buffer pool temporary index physical reads = 0

Page 24 of 39

Page 29: Wal Mart Problem Analysis

Asynchronous pool index page reads = 3720Buffer pool index writes = 6374Asynchronous pool index page writes = 6049Total buffer pool read time (ms) = 307010Total buffer pool write time (ms) = 191137Total elapsed asynchronous read time = 26976Total elapsed asynchronous write time = 181463Asynchronous data read requests = 2559Asynchronous index read requests = 1936No victim buffers available = 64549LSN Gap cleaner triggers = 7028Dirty page steal cleaner triggers = 1954Dirty page threshold cleaner triggers = 11873Time waited for prefetch (ms) = 22206Unread prefetch pages = 0Direct reads = 139492Direct writes = 5310Direct read requests = 24225Direct write requests = 548Direct reads elapsed time (ms) = 32103Direct write elapsed time (ms) = 6087Database files closed = 110Data pages copied to extended storage = 0Index pages copied to extended storage = 0Data pages copied from extended storage = 0Index pages copied from extended storage = 0

Host execution elapsed time = 0.081358

Commit statements attempted = 10366Rollback statements attempted = 3556Dynamic statements attempted = 268081Static statements attempted = 14592Failed statement operations = 128Select SQL statements executed = 161015Update/Insert/Delete statements executed = 7820DDL statements executed = 0

Internal automatic rebinds = 0Internal rows deleted = 0Internal rows inserted = 0Internal rows updated = 0Internal commits = 3543Internal rollbacks = 0Internal rollbacks due to deadlock = 0

Rows deleted = 629Rows inserted = 5079Rows updated = 1978Rows selected = 222844Rows read = 2687368Binds/precompiles attempted = 0

Log space available to the database (Bytes)= 242187554Log space used by the database (Bytes) = 2612446Maximum secondary log space used (Bytes) = 0Maximum total log space used (Bytes) = 21381989

Page 25 of 39

Page 30: Wal Mart Problem Analysis

Secondary logs allocated currently = 0Log pages read = 0Log pages written = 39494Appl id holding the oldest transaction = 96

Package cache lookups = 172275Package cache inserts = 3166Package cache overflows = 0Package cache high water mark (Bytes) = 8065889Application section lookups = 268751Application section inserts = 6585

Catalog cache lookups = 21396Catalog cache inserts = 2105Catalog cache overflows = 0Catalog cache high water mark = 0

Workspace Information

Shared high water mark = 13716428 Corresponding shared overflows = 0 Total shared section inserts = 6539 Total shared section lookups = 40413 Private high water mark = 44255 Corresponding private overflows = 0 Total private section inserts = 46 Total private section lookups = 374

Number of hash joins = 11Number of hash loops = 0Number of hash join overflows = 0Number of small hash join overflows = 0

Memory usage for database:

Node number = 0 Memory Pool Type = Backup/Restore/Util Heap Current size (bytes) = 16384 High water mark (bytes) = 622592 Maximum size allowed (bytes) = 20660224

Node number = 0 Memory Pool Type = Package Cache Heap Current size (bytes) = 10321920 High water mark (bytes) = 10321920 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Catalog Cache Heap Current size (bytes) = 442368 High water mark (bytes) = 491520 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 10010624

Page 26 of 39

Page 31: Wal Mart Problem Analysis

High water mark (bytes) = 10010624 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 2244608 High water mark (bytes) = 2244608 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 10010624 High water mark (bytes) = 10010624 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 4358144 High water mark (bytes) = 4358144 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 4358144 High water mark (bytes) = 4358144 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 4358144 High water mark (bytes) = 4358144 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 655360 High water mark (bytes) = 655360 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 393216 High water mark (bytes) = 393216 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 262144 High water mark (bytes) = 262144 Maximum size allowed (bytes) = 4293918720

Node number = 0 Memory Pool Type = Buffer Pool Heap Current size (bytes) = 196608 High water mark (bytes) = 196608 Maximum size allowed (bytes) = 4293918720

Page 27 of 39

Page 32: Wal Mart Problem Analysis

Node number = 0 Memory Pool Type = Lock Manager Heap Current size (bytes) = 21102592 High water mark (bytes) = 21102592 Maximum size allowed (bytes) = 21250048

Node number = 0 Memory Pool Type = Database Heap Current size (bytes) = 7798784 High water mark (bytes) = 7815168 Maximum size allowed (bytes) = 206979072

Node number = 0 Memory Pool Type = Other Memory Current size (bytes) = 86048768 High water mark (bytes) = 86048768 Maximum size allowed (bytes) = 185270272

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384

Page 28 of 39

Page 33: Wal Mart Problem Analysis

High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 2523136 High water mark (bytes) = 2523136 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 16384 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 16384 High water mark (bytes) = 32768 Maximum size allowed (bytes) = 5210112

Node number = 0 Memory Pool Type = Application Control Heap Current size (bytes) = 2523136 High water mark (bytes) = 2523136

Page 29 of 39

Page 34: Wal Mart Problem Analysis

Maximum size allowed (bytes) = 5210112

Database Manager Snapshot

Node type = Enterprise Server Edition with local and remote clientsInstance name = db2inst8Number of database partitions in DB2 instance = 1Database manager status = Active

Product name = DB2 v8.1.1.40Service level = n040122 (U497250)

Private Sort heap allocated = 0Private Sort heap high water mark = 20480Post threshold sorts = 0Piped sorts requested = 1571026Piped sorts accepted = 1571026

Start Database Manager timestamp = 04-16-2004 10:57:25.107575Last reset timestamp =Snapshot timestamp = 07-19-2004 15:14:26.011325

Remote connections to db manager = 19Remote connections executing in db manager = 0Local connections = 1Local connections executing in db manager = 0Active local databases = 2

High water mark for agents registered = 95High water mark for agents waiting for a token = 0Agents registered = 87Agents waiting for a token = 0Idle agents = 65

Committed private Memory (Bytes) = 6619136

Switch list for db partition number 0Buffer Pool Activity Information (BUFFERPOOL) = ON 07-01-2004 09:00:24.437007Lock Information (LOCK) = ON 04-16-2004 11:25:51.216843Sorting Information (SORT) = ON 07-01-2004 09:00:07.506274SQL Statement Information (STATEMENT) = ON 07-01-2004 10:11:28.378558Table Activity Information (TABLE) = ON 07-01-2004 09:00:17.564299Take Timestamp Information (TIMESTAMP) = ON 04-16-2004 10:57:25.107575Unit of Work Information (UOW) = ON 07-01-2004 09:00:28.206864

Agents assigned from pool = 190469

Page 30 of 39

Page 35: Wal Mart Problem Analysis

Agents created from empty pool = 176Agents stolen from another application = 0High water mark for coordinating agents = 57Max agents overflow = 0Hash joins after heap threshold exceeded = 0

Total number of gateway connections = 0Current number of gateway connections = 0Gateway connections waiting for host reply = 0Gateway connections waiting for client request = 0Gateway connection pool agents stolen = 0

Node FCM information corresponds to = 0Free FCM buffers = 4096Free FCM buffers low water mark = 4068Free FCM message anchors = 1280Free FCM message anchors low water mark = 1280Free FCM connection entries = 1280Free FCM connection entries low water mark = 1272Free FCM request blocks = 1868Free FCM request blocks low water mark = 1851

Memory usage for database manager:

Node number = 0 Memory Pool Type = FCMBP Heap Current size (bytes) = 17514496 High water mark (bytes) = 17514496 Maximum size allowed (bytes) = 17809408

Node number = 0 Memory Pool Type = Database Monitor Heap Current size (bytes) = 344064 High water mark (bytes) = 540672 Maximum size allowed (bytes) = 540672

Node number = 0 Memory Pool Type = Other Memory Current size (bytes) = 4866048 High water mark (bytes) = 4980736 Maximum size allowed (bytes) = 22216704

Database Configuration for Database OW_DEV

Database configuration release level = 0x0a00 Database release level = 0x0a00

Database territory = US Database code page = 1208 Database code set = UTF-8 Database country/region code = 1

Dynamic SQL Query management (DYN_QUERY_MGMT) = DISABLE

Discovery support for this database (DISCOVER_DB) = ENABLE

Page 31 of 39

Page 36: Wal Mart Problem Analysis

Default query optimization class (DFT_QUERYOPT) = 0 Degree of parallelism (DFT_DEGREE) = 1 Continue upon arithmetic exceptions (DFT_SQLMATHWARN) = NO Default refresh age (DFT_REFRESH_AGE) = 0 Number of frequent values retained (NUM_FREQVALUES) = 10 Number of quantiles retained (NUM_QUANTILES) = 20

Backup pending = NO

Database is consistent = NO Rollforward pending = NO Restore pending = NO

Multi-page file allocation enabled = NO

Log retain for recovery status = NO User exit for logging status = NO

Data Links Token Expiry Interval (sec) (DL_EXPINT) = 60 Data Links Write Token Init Expiry Intvl(DL_WT_IEXPINT) = 60 Data Links Number of Copies (DL_NUM_COPIES) = 1 Data Links Time after Drop (days) (DL_TIME_DROP) = 1 Data Links Token in Uppercase (DL_UPPER) = NO Data Links Token Algorithm (DL_TOKEN) = MAC0

Database heap (4KB) (DBHEAP) = 10000 Size of database shared memory (4KB) (DATABASE_MEMORY) = AUTOMATIC Catalog cache size (4KB) (CATALOGCACHE_SZ) = 64 Log buffer size (4KB) (LOGBUFSZ) = 512 Utilities heap size (4KB) (UTIL_HEAP_SZ) = 5000 Buffer pool size (pages) (BUFFPAGE) = 1000 Extended storage segments size (4KB) (ESTORE_SEG_SZ) = 16000 Number of extended storage segments (NUM_ESTORE_SEGS) = 0 Max storage for lock list (4KB) (LOCKLIST) = 5000

Max size of appl. group mem set (4KB) (APPGROUP_MEM_SZ) = 30000 Percent of mem for appl. group heap (GROUPHEAP_RATIO) = 70 Max appl. control heap size (4KB) (APP_CTL_HEAP_SZ) = 4096

Sort heap thres for shared sorts (4KB) (SHEAPTHRES_SHR) = (SHEAPTHRES) Sort list heap (4KB) (SORTHEAP) = 4096 SQL statement heap (4KB) (STMTHEAP) = 2048 Default application heap (4KB) (APPLHEAPSZ) = 2048 Package cache size (4KB) (PCKCACHESZ) = 2000 Statistics heap size (4KB) (STAT_HEAP_SZ) = 4384

Interval for checking deadlock (ms) (DLCHKTIME) = 1000 Percent. of lock lists per application (MAXLOCKS) = 10 Lock timeout (sec) (LOCKTIMEOUT) = 60

Changed pages threshold (CHNGPGS_THRESH) = 60 Number of asynchronous page cleaners (NUM_IOCLEANERS) = 30 Number of I/O servers (NUM_IOSERVERS) = 1 Index sort flag (INDEXSORT) = YES Sequential detect flag (SEQDETECT) = NO Default prefetch size (pages) (DFT_PREFETCH_SZ) = 32

Page 32 of 39

Page 37: Wal Mart Problem Analysis

Track modified pages (TRACKMOD) = OFF

Default number of containers = 1 Default tablespace extentsize (pages) (DFT_EXTENT_SZ) = 32

Max number of active applications (MAXAPPLS) = 5000 Average number of active applications (AVG_APPLS) = 1 Max DB files open per application (MAXFILOP) = 100

Log file size (4KB) (LOGFILSIZ) = 2000 Number of primary log files (LOGPRIMARY) = 10 Number of secondary log files (LOGSECOND) = 20 Changed path to log files (NEWLOGPATH) = Path to log files = /u/udbsys/db2inst8/NODE0000/SQL00008/SQLOGDIR/ Overflow log path (OVERFLOWLOGPATH) = Mirror log path (MIRRORLOGPATH) = First active log file = Block log on disk full (BLK_LOG_DSK_FUL) = NO Percent of max active log space by transaction(MAX_LOG) = 0 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0

Group commit count (MINCOMMIT) = 1 Percent log file reclaimed before soft chckpt (SOFTMAX) = 100 Log retain for recovery enabled (LOGRETAIN) = OFF User exit for logging enabled (USEREXIT) = OFF

Auto restart enabled (AUTORESTART) = ON Index re-creation time (INDEXREC) = SYSTEM (RESTART) Default number of loadrec sessions (DFT_LOADREC_SES) = 1 Number of database backups to retain (NUM_DB_BACKUPS) = 12 Recovery history retention (days) (REC_HIS_RETENTN) = 366

TSM management class (TSM_MGMTCLASS) = TSM node name (TSM_NODENAME) = TSM owner (TSM_OWNER) = TSM password (TSM_PASSWORD) =

Database Manager Configuration

Node type = Enterprise Server Edition with local and remote clients

Database manager configuration release level = 0x0a00

CPU speed (millisec/instruction) (CPUSPEED) = 6.376647e-07 Communications bandwidth (MB/sec) (COMM_BANDWIDTH) = 1.000000e+02

Max number of concurrently active databases (NUMDB) = 8 Data Links support (DATALINKS) = NO Federated Database System Support (FEDERATED) = NO Transaction processor monitor name (TP_MON_NAME) =

Default charge-back account (DFT_ACCOUNT_STR) =

Page 33 of 39

Page 38: Wal Mart Problem Analysis

Java Development Kit installation path (JDK_PATH) = /usr/java130/

Diagnostic error capture level (DIAGLEVEL) = 3 Notify Level (NOTIFYLEVEL) = 3 Diagnostic data directory path (DIAGPATH) = /u/udb/db2inst8/sqllib/db2dump

Default database monitor switches Buffer pool (DFT_MON_BUFPOOL) = ON Lock (DFT_MON_LOCK) = ON Sort (DFT_MON_SORT) = ON Statement (DFT_MON_STMT) = ON Table (DFT_MON_TABLE) = ON Timestamp (DFT_MON_TIMESTAMP) = ON Unit of work (DFT_MON_UOW) = ON Monitor health of instance and databases (HEALTH_MON) = ON

SYSADM group name (SYSADM_GROUP) = DB2IADM1 SYSCTRL group name (SYSCTRL_GROUP) = SYSMAINT group name (SYSMAINT_GROUP) = SYSMON group name (SYSMON_GROUP) =

Database manager authentication (AUTHENTICATION) = SERVER Cataloging allowed without authority (CATALOG_NOAUTH) = NO Trust all clients (TRUST_ALLCLNTS) = YES Trusted client authentication (TRUST_CLNTAUTH) = CLIENT Bypass federated authentication (FED_NOAUTH) = NO

Default database path (DFTDBPATH) = /u/udbsys

Database monitor heap size (4KB) (MON_HEAP_SZ) = 10000 Java Virtual Machine heap size (4KB) (JAVA_HEAP_SZ) = 2048 Audit buffer size (4KB) (AUDIT_BUF_SZ) = 0 Size of instance shared memory (4KB) (INSTANCE_MEMORY) = AUTOMATIC Backup buffer default size (4KB) (BACKBUFSZ) = 1024 Restore buffer default size (4KB) (RESTBUFSZ) = 1024

Sort heap threshold (4KB) (SHEAPTHRES) = 40000

Directory cache support (DIR_CACHE) = YES

Application support layer heap size (4KB) (ASLHEAPSZ) = 15 Max requester I/O block size (bytes) (RQRIOBLK) = 32767 Query heap size (4KB) (QUERY_HEAP_SZ) = 10000 DRDA services heap size (4KB) (DRDA_HEAP_SZ) = 128

Workload impact by throttled utilities(UTIL_IMPACT_LIM) = 100

Priority of agents (AGENTPRI) = SYSTEM Max number of existing agents (MAXAGENTS) = 400 Agent pool size (NUM_POOLAGENTS) = 200(calculated) Initial number of agents in pool (NUM_INITAGENTS) = 0 Max number of coordinating agents (MAX_COORDAGENTS) = (MAXAGENTS - NUM_INITAGENTS)

Page 34 of 39

Page 39: Wal Mart Problem Analysis

Max no. of concurrent coordinating agents (MAXCAGENTS) = MAX_COORDAGENTS Max number of client connections (MAX_CONNECTIONS) = MAX_COORDAGENTS

Keep fenced process (KEEPFENCED) = NO Number of pooled fenced processes (FENCED_POOL) = MAX_COORDAGENTS Initial number of fenced processes (NUM_INITFENCED) = 0

Index re-creation time (INDEXREC) = RESTART

Transaction manager database name (TM_DATABASE) = 1ST_CONN Transaction resync interval (sec) (RESYNC_INTERVAL) = 180

SPM name (SPM_NAME) = hotsti1a SPM log size (SPM_LOG_FILE_SZ) = 256 SPM resync agent limit (SPM_MAX_RESYNC) = 20 SPM log path (SPM_LOG_PATH) =

TCP/IP Service name (SVCENAME) = 50000 Discovery mode (DISCOVER) = SEARCH Discover server instance (DISCOVER_INST) = ENABLE

Maximum query degree of parallelism (MAX_QUERYDEGREE) = ANY Enable intra-partition parallelism (INTRA_PARALLEL) = YES

No. of int. communication buffers(4KB)(FCM_NUM_BUFFERS) = 4096 Node connection elapse time (sec) (CONN_ELAPSE) = 10 Max number of node connection retries (MAX_CONNRETRIES) = 5 Max time difference between nodes (min) (MAX_TIME_DIFF) = 60

db2start/db2stop timeout (min) (START_STOP_TIME) = 10

Page 35 of 39