IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

72
IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial

Transcript of IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

Page 1: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

DB2 Performance Expert for Multiplatforms Version 2.1Step-by-step tutorial

Page 2: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software2

Introduction

This presentation is part of the demo package that gets you started with DB2 Performance Expert for Multiplatforms V2.1.

The demo package consists of:

• Videos that show scenarios for monitoring DB2 performance with DB2 Performance Expert for Multiplatforms V2.1.

• A step-by-step tutorial (this presentation) that can be completed optionally and teaches you to:

− Install and configure DB2 Performance Expert for Multiplatforms V2.1 on your Windows machine.

− Run workload scripts that allow you to perform the scenarios presented in the videos.

− To complete the step-by-step tutorial, you will probably need 2 hours.

Continue on the next page with the step-by-step tutorial...

Page 3: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Installing and configuring DB2 Performance Expert for Multiplatforms Version 2.1

Page 4: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software4

Getting startedInstalling DB2 Performance Expert Server

1. To install Performance Expert Server. Create a user group on your local Windows operating system.

• In Windows XP:Select Start -> Control Panel -> Administrative Tools -> Computer Management.

• In Windows 2000:Select Start -> Settings -> Control Panel -> Administrative Tools -> Computer Management.

• Open the Local users and groups folder.• Right-click Groups and click New group.• Type <group> in the Group name field where <group> denotes a name of your choice. In the video and

tutorial the name PE is used. • Click Add.• Type the user ID previously described.• Click Create.• Click Close.• Close the Computer Management window.

During this tutorial use a user ID with the following privileges:

• Administrator rights in the Windows Operating System Add this user ID to the user group <group> that you have created in the first

step. If you have a sysadm group specified in DB2, add the user ID to sysadm group aswell.

Start the db2pesrv.install-on-win.exe file. Important: During the installation, you are asked whether you want to configure

Performance Expert Server or finish the installation. Select Finish installation. Don‘t change the current database manager instance of DB2 during this tutorial.

Page 5: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software5

Getting startedConfiguring DB2 Performance Expert Server

2. To configure Performance Expert Server: Go to the bin subdirectory of your installation directory of Performance Expert

Server.

Open the sample response file pesample.rsp in an editor.

Replace the placeholders for USER LOGIN NAME and USER PASSWORD with your user ID and password.

Open a Command Prompt window.

• Type db2cmd.

• In the new window, change to the bin subdirectory of your installation directory of Performance Expert Server.

• Type pesample and press Enter.

• This script file:− Creates the PEDEMO database.− Configures the local DB2 instance for monitoring.− Registers the PEDEMO database for monitoring.− Starts Performance Expert Server.

The Command Prompt window remains open, displaying the message PE Instance status: alive.

Page 6: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software6

Getting startedInstalling and configuring DB2 Performance Expert Client

2. To install Performance Expert Client: Start the db2pe.install-on-win.exe file.

3. To prepare the configuration of Performance Expert Client: Find out the port number of the DB2 instance on which Performance

Expert Server runs:

• In DB2 V8, open the DB2 Control Center.

• Right-click the DB2 instance on which Performance Expert Server runs.

• Click Setup communications.

• Click Properties (2).

• Write down the number displayed in the Port number field.Note: If no port has been assigned by default, click Default and write down the port number that is displayed.

Page 7: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software7

Getting startedInstalling and configuring DB2 Performance Expert Client

4. Start Performance Expert Client: Click Start -> Programs -> IBM DB2 Performance Expert V2 -> IBM

DB2 Performance Expert V2.

Choose Extended Design and click OK.

Page 8: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software8

1 Click New DB2 System.You can also use the toolbar or the menu for opening this dialog.

2 Select DB2 on Multiplatforms and click Next.

3 Type localhost and the port number you have written down in the previous step, and click Next.

Continue on the next page...

Getting startedConfiguring DB2 Performance Expert Client - Part 1 of 4

Page 9: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software9

4 Click Retrieve Monitored DB2 instances and type your DB2 user name and password.

5 The instances that are monitored by the specified Performance Expert Server are displayed in the table.

6 Type PE as the DB2 connection alias for the performance database of the monitored DB2 instance and click Finish.

Continue on the next page...

Getting startedConfiguring DB2 Performance Expert Client - Part 2 of 4

Page 10: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software10

7 Open the Monitored Objects folder in order to see the DB2 instance that you have just added.

8 Log on to the DB2 instance by using the Logon link or by right- clicking the DB2 instance.

Continue on the next page...

Getting startedConfiguring DB2 Performance Expert Client - Part 3 of 4

Page 11: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software11

9 Right-click the instance you have just configured and click Properties.

10 On the History page, enable the history data collection for locking conflicts by selecting the appropriate check box.On this page, you can specify the settings for recording history data.

Continue on the next page...

Getting startedConfiguring DB2 Performance Expert Client – Part 4 of 4

11 On the Performance Warehouse page, change the storage interval to 1 hour and the interval multiplier for summarizing the history data to 1. Then click OK.History data is then stored every hour. It is stored as delta values, where each delta covers a 15-minute interval.

Page 12: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software12

To start the workload script: Copy the file demo.jar to the bin subdirectory of your installation

directory of Performance Expert Server. Open a Command Prompt window. Change to the bin subdirectory of your installation directory of

Performance Expert Server. Type pedemo and press Enter. Important: The six additional Command Prompt windows that appear

after starting the workload program must remain open during the tutorial but can be minimized.

Getting startedStarting the workload script – Part 1 of 2

Page 13: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software13

Getting startedStarting the workload script – Part 1 of 2

Let the workload script pedemo run for about one minute until it has created all objects, such as the buffer pools.

Press Ctrl-C to stop pedemo. Type Y and press Enter. Type db2cmd. In the new window, type db2stop force and press Enter to stop the DB2

instance. Type db2start and press Enter to start the DB2 instance. Restart DB2 Performance Expert Server by clicking Start -> Programs ->

IBM DB2 Performance Expert Server V2 -> Start Performance Expert Server

In the workload script command window, type pedemo and press Enter. Important: The six additional Command Prompt windows that appear after

starting the workload program must remain open during the tutorial but can be minimized.

If you have DB2 Version 7 installed:In DB2 Version 7 new buffer pools are only available after restarting the DB2 instance. To make them available for this tutorial, do the following:

You have now successfully installed and configured DB2 Performance ExpertServer and Client and have started the workload script that allows you tomonitor DB2 performance during the following scenarios.

Page 14: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Performance scenarios

Page 15: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software15

Performance scenarios

The following performance scenarios are covered: Scenario 1: Discovering and analyzing a buffer pool problem

• Configuring graphs for your most important performance values

• Analyzing a buffer pool problem Scenario 2: Finding the cause of a deadlock

• Defining alert thresholds

• Analyzing the cause for a deadlock

Page 16: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Scenario 1: Discovering and analyzing a buffer pool problem

Page 17: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software17

Scenario 1: Discovering and analyzing a buffer pool problem Monitoring the general performance of DB2

As a database administrator, you monitor the general performance of your DB2 system to find critical changes in the system.

To do this, you can:

Configure graphs for your most important performance values. DB2 Performance Expert V2.1 allows you to keep an eye on your DB2 systems by using graphs for your most important performance indicators.

Define alert thresholds.Critical changes that exceed certain thresholds result in alerts, which you can receive via e-mail.

In this first scenario, you configure graphs for important performance values.

Page 18: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software18

Scenario 1: Discovering and analyzing a buffer pool problem Configuring graphs for important performance values

The following performance values are important indicators of your DB2performance:

Buffer pool hit ratio Failed and successful SQL statements Sort overflows Rows selected vs. Rows read Number of deadlocks

In general, it is always a good idea to keep an eye on these values. Therefore,you configure them as performance graphs in DB2 PerformanceExpert V2.1.

Page 19: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Scenario 1: Discovering and analyzing a buffer pool problem

Configuring graphs

Page 20: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software20

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs - Buffer pool hit ratio

1 Click System Health for the DB2 instance that you have added to the System Overview window.You can also use the component list or the menu for opening System Health.

2 Click open a predefined data view.

Continue on the next page...

Page 21: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software21

3 Select Compare Hit ratio of buffer pools in the list and click OK.

4 Select all four buffer pools in the list and click OK.You might see more than four buffer pools on your system. Select all buffer pools that are displayed.

Continue on the next page...

5 The data view Compare Hit ratio of a buffer pools is being created.

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs - Buffer pool hit ratio

Page 22: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software22

6 Click the Autorefresh toolbar button to start data collection.

7 Click Legend to see the legend of the data view.

Continue on the next page...

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs - Buffer pool hit ratio

Page 23: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software23

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs – Failed & successful SQL statements

8 Right-click the Data Views folder in the System Overview tree and click Open Predefined Data View.

9 Select SQL stmt throughput and click OK.

Continue on the next page...

10 Select PEDEMO and click OK.This window only appears if there is more than one database on the monitored DB2 instance.

Page 24: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software24

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs – Sort overflows

11 Right-click the Data Views folder in the System Overview node and click Open Predefined Data View.

12 Select Sort overflows [%] and click OK.

Continue on the next page...

13 Select PEDEMO and click OK.This window only appears if there is more than one database on the monitored DB2 instance.

Page 25: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software25

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs – Rows selected vs. Rows read

14 Right-click the Data Views folder in the System Overview tree and click New.

15 Type Rows selected vs. Rows read in the Data view name field, select Databases as data view category, and click Next.

Continue on the next page...

16 Select Compare counters of PEDEMO. From the Select counters list, select the Rows selected by SQL and Rows read by SQL check boxes. Click Not stacked as type of counter display and then click Next.

Page 26: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software26

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs – Rows selected vs. Rows read

17 Select Dynamic scale for the y-axis and click Next.The y-axis then changes its scale to automatically adapt to the highest values of the counters.

18 Click Finish.

Continue on the next page...

Page 27: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software27

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs – Number of deadlocks

Continue on the next page...

19 Right-click the Data Views folder in the System Overview tree and click New....

20 Type Deadlocks in the Data view name field, select Databases as data view category, and click Next.

21 Select Compare counters of PEDEMO. From the Select counters list, select the Deadlocks detected check box, click Not stacked as type of counter display, and click Next.

Page 28: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software28

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs – Number of deadlocks

Continue on the next page...

22 Select Dynamic scale for the y-axis and click Next.The y-axis then changes its scale to automatically adapt to the highest number of deadlocks.

23 Click Finish.

Page 29: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software29

25 All data views in the System Overview folder are displayed in the System Overview window.

Start and stop data collection by clicking the Autorefresh toolbar button.

Click the System Overview toolbar button to navigate to System Overview.

Continue on the next page...

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs

24 Select View Tile Data Views to order all data views on the workspace.

Page 30: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software30

Continue on the next page...

Scenario 1: Discovering and analyzing a buffer pool problemConfiguring graphs

You have successfully created five data views.

26 In the System Overview window, the data views are displayed. 27 Click Monitored Objects to

see the data views of all systems to which you are logged on.

Page 31: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Scenario 1: Discovering and analyzing a buffer pool problem

Interpreting graphs

Page 32: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software32

Continue on the next page...

Scenario 1: Discovering and analyzing a buffer pool problemInterpreting graphs

The graphs in the System overview window allow you to keep an eye on the system. You can see that there is something wrong with one of the buffer pools.

Page 33: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software33

Continue on the next page...

Scenario 1: Discovering and analyzing a buffer pool problemInterpreting graphs

5 SQL stmt throughputThe SQL statement throughput is in good shape. There are no failed SQL statements, which would appear red in the graph. Failed statements can have different causes, e.g. failures in the SQLs generated by an application, or rollbacks e.g. after a deadlock.

2 Rows selected vs. Rows readThe ratio of selected rows to read rows is relatively even which is a positive performance indicator. It shows that almost all data that is read from disk to memory is used by the applications.A large difference between the two counters results in bad performance. The reason could be e.g. a missing or ineffective index.

3 DeadlocksIn the picture no deadlock appears. You might see deadlocks that are produced by the workload script. They will be the topic of Scenario 2.

4 Sort overflowsNone of the sorts (grey bars) had to overflow to disk which is a positive performance indicator. A high percentage of sort overflows results in poor performance and can be resolved by increasing the sortheap value.

1 Compare hit ratio of buffer pools.Click a bar of a data view to display its values.The hit ratio of buffer pool FRUITS is below 80%. After interpreting the other data views, you will analyze this problem.

1

2 3

45

Page 34: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Scenario 1: Discovering and analyzing a buffer pool problem

Finding the cause of the buffer pool problem

Page 35: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software35

Continue on the next page...

Scenario 1: Discovering and analyzing a buffer pool problem

Finding the cause of the buffer pool problem

1 Go to the bottom of the problem by right-clicking the data view Compare the Hit ratio of buffer pools and selecting Show in Statistics Details.You can also use the component list or the menu for opening Statistics Details.

Page 36: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software36

Continue on the next page...

Scenario 1: Discovering and analyzing a buffer pool problem

Finding the cause of the buffer pool problem2 In the Buffer Pools pane of the Statistics Details window, double-click FRUITS.The buffer pools are not displayed if you are running on DB2 V7. In this case you have to refer to the DB2 Control Center to view the buffer pool sizes. See the next page for a screenshot.

3 Select Configuration in the tree and double-click the FRUITS entry.

Page 37: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software37

Scenario 1: Discovering and analyzing a buffer pool problem

Finding the cause of the buffer pool problem

4 You discover that the current size of buffer pool is very small and decide to enlarge it using a DB2 utility of your choice, such as DB2 Control Center.The size of the buffer pool on your system might differ from the sizes displayed in the screenshot.

You have successfully detected and analyzed a buffer pool problem.

If your system is running on DB2 V7 you find the buffer pool sizes in the DB2 Control Center.

Page 38: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software38

Scenario 1: Discovering and analyzing a buffer pool problem

In this scenario, you learned how to:

Create predefined and new performance graphs A set of five important performance indicators was introduced that you

can use for future monitoring. Go to the bottom of a problem in statistics.

Page 39: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Scenario 2: Finding the cause of a deadlock

Page 40: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software40

Scenario 2: Finding the cause of a deadlockStarting monitoring the general performance of DB2

You have learned that you can monitor the general performance of your DB2 system by:

Configuring graphs for your most important performance values Defining alert thresholds

In scenario 1, you have configured graphs. In scenario 2, you will define alert thresholds for important performance values.

Page 41: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Scenario 2: Finding the cause of a deadlock

Defining alert thresholds

Page 42: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software42

In DB2 Performance Expert for Multiplatforms V2.1, you can perform periodicand event exception processing.Periodic exception processing compares the values of your performance countersto thresholds that you have set for the values and alerts you if a thresholdis exceeded.Event exception processing alerts you as soon as a DB2 event occurs on yoursystem. Currently, you can monitor the DB2 event „Deadlock“.

You define alert thresholds for the following performance values:

Buffer pool hit ratio Failed SQL statements Sort overflows

Deadlocks

Scenario 2: Finding the cause of a deadlockDefining alert thresholds

Periodic Exception Processing

Event Exception Processing

Page 43: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software43

Scenario 2: Finding the cause of a deadlockDefining alert thresholds

1 In the System Overview window, click Tools –> Exceptions –> Exception Processing to open the Exception Processing window.

2 In the Exception Processing tree, you can define and activate event exception processing and define threshold sets for periodic exception processing.

You first create a threshold set and define tresholds for it.

Continue on the next page...

Page 44: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software44

Scenario 2: Finding the cause of a deadlockDefining alert thresholds – Threshold Set (periodic)

3 In the Exception Processing window, click Exception Processing –> New Threshold Set. 4 Select Multiplatforms as

operating system and type General Performance as threshold set name and pedemo as author.Click OK.

Continue on the next page...

5 Click the Create a new threshold toobar button.You can also use the menu to create a new threshold.

Page 45: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software45

Scenario 2: Finding the cause of a deadlockDefining alert thresholds – Threshold set (periodic) – Buffer pool hit ratio

Continue on the next page...

6 Select Statistics, Buffer Pools, and Buffer Pools Hit ratio (%).

Select <. Type 90 as warning threshold and 80 as problem threshold.

Type PEDEMO as a qualifier for Buffer Pools Database Name. Click the Add button (right arrow).

Click OK. 7 The first threshold appears in the threshold set table.

Click the Create a new threshold toolbar button.

Page 46: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software46

Scenario 2: Finding the cause of a deadlockDefining alert thresholds – Threshold set (periodic) – Failed SQL statements

Continue on the next page...

8 Select Applications, SQL Activity, and Statements Failed operations.

Select >. Type 1 as warning threshold and 2 as problem threshold and select per minute.

Type PEDEMO as a qualifier for Database DB name. Click the Add button (right arrow).

Click OK. 9 Click the Create a new threshold toolbar button.

Page 47: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software47

Scenario 2: Finding the cause of a deadlockDefining alert thresholds – Threshold set (periodic) – Sort overflows

Continue on the next page...

10 Select Applications, Sort, and Sort overflows.

Select >. Type 5 as warning threshold and 10 as problem threshold and select by percentage.

Type PEDEMO as a qualifier for Database DB name. Click the Add button (right arrow).

Click OK. 11 Click Threshold Set Close.

In the message that appears, click Yes.

Page 48: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software48

Scenario 2: Finding the cause of a deadlockDefining alert thresholds – Activation

Continue on the next page...

12 Right-click DB2 in the DB2 System table and click Activation.

13 Select the threshold set General Performance, type 1 as the interval multiplier, and click Start Periodic Exception Processing.

14 Click Start Event Exception Processing.

15 You have successfully started event and periodic exception processing.

Click Close.

Page 49: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software49

Scenario 2: Finding the cause of a deadlockViewing the exception log and changing settings

Continue on the next page...

16 In the Exception Processing window, you can click Exception Processing in the tree and view both the event and the periodic exception log.

Page 50: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software50

Scenario 2: Finding the cause of a deadlockViewing the exception log

Continue on the next page...

17 If an exception appears in the log table, you can double-click it to view exception details.

Page 51: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software51

Scenario 2: Finding the cause of a deadlockChanging settings in exception processing

Continue on the next page...

18 By clicking Exception Processing –> Settings, you open the Exception Settings window.

Here, you can define how many exceptions are kept and the notification settings for event and periodic exceptions.

You can also set up an e-mail notification for the exceptions that occur.

Page 52: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group

®

Scenario 2: Finding the cause of a deadlock

Analyzing deadlock events

Page 53: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software53

Scenario 2: Finding the cause of a deadlockDetecting a dead lock event

Continue on the next page...

2 Deadlock events appear at regular intervals.

1 Click the System Overview toolbar icon to navigate to System Overview.

Page 54: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software54

Scenario 2: Finding the cause of a deadlockDetecting a dead lock event

Continue on the next page...

3 Double-click a deadlock to see its details.

5 Double-click Performance Warehouse – Expert.

4 For each application involved in the deadlock, you can view the SQL in the Deadlock Details window.

Because you have not programmed the application, the SQL might not give you enough information to understand the reason for the deadlock. But because the deadlocks occur regularly, you can collect SQL activity data to find out more about them when they appear.

Page 55: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software55

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

6 Open the Multiplatforms folder, right-click the Process Groups folder, and click Create.

7 Type pedemo deadlock as group name and click OK.

Page 56: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software56

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

8 Right-click the public process DB2PM.Template.SQL Activity CRD for Queries and click Copy to copy it to your pedemo folder.CRD stands for Collect Report Data.

9 Click OK.

Page 57: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software57

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

10 Right-click the CRD step of the SQL Activity CRD for Queries process and click Properties.

11 On the Options page of the CRD Step Properties window, select PEDEMO as database name, type 00:20:00 (= 20 minutes) for the elapsed time, and click OK.

Page 58: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software58

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

12 Right-click the Load step of the SQL Activity CRD for Queries process and click Properties.

13 On the Options page of the Load Step Properties window, select the Retrieve the text of the static SQL statements check box and click OK.

Page 59: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software59

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

14 To start the collection of data, right-click the process SQL Activity CRD for Queries and click Execute.

15 Click Close.

Page 60: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software60

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

16 Click Process Executions to see the execution of the process you have just started.

17 Double-click the execution SQL Activity CRD for Queries in the table.

18 In the Process Execution Details window, you see the status of the process step. – It is currently running.

19 Because you want to collect data about a deadlock while it occurs, you return to the System Overview window to monitor the occurrence of the deadlocks.Click the System Overview toolbar button.

Page 61: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software61

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

20 Wait until a new deadlock occurs...

21 Double-click the deadlock event.

22 Deadlock details are shown in this window.Click the Application tabs to view the details, for example the SQL, of the two applications that are involved in the deadlock.

Page 62: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software62

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

23 Copy (Ctrl+C) the application IDs of the two applications that cause the deadlock into a Notepad document.

Click Close.

24 Click Performance Expert Warehouse – Expert to return to the Performance Warehouse window.

Page 63: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software63

Scenario 2: Finding the cause of a deadlockCollecting SQL activity data

Continue on the next page...

25 Now that you know that a deadlock has occurred while the data was collected, click Stop to stop the collection of SQL activity data. 26 Wait until the CRD and LOAD

steps complete successfully. Click Cancel.

You have now successfully collected the data you need to analyze by running a query on it.

Page 64: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software64

Scenario 2: Finding the cause of a deadlockAnalyzing the collected SQL Activity data by running a query

Continue on the next page...

27 Right-click Query groups and click Create.

29 To define a query, right-click Queries under the pedemo deadlock folder and click Create.

28 Type pedemo deadlock as query group name and click OK.

Page 65: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software65

Scenario 2: Finding the cause of a deadlockAnalyzing the collected SQL Activity data by running a query

Continue on the next page...

30 Type pedemo deadlock SQL details as query name and click the Definition tab.

31 Select the blue SQL statement in the text box to the right of this presentation page, copy it (Ctrl+C) and replace the text under Query with it (Ctrl+V).Click OK.Many users already have their own performance queries and can reuse these queries with Performance Warehouse – Queries.

SELECT OP.START_TIME, OP.STOP_TIME, OP.APPL_ID, CASE OP.STMT_OPERATION WHEN 1 THEN 'Prepare' WHEN 2 THEN 'Execute' WHEN 3 THEN 'Execute Immediate' WHEN 4 THEN 'Open' WHEN 5 THEN 'Fetch' WHEN 6 THEN 'Close' WHEN 7 THEN 'Describe' WHEN 8 THEN 'Static Commit' WHEN 9 THEN 'Static Rollback' WHEN 10 THEN 'Free Locator' WHEN 11 THEN 'Prepare to commit (2-phase commit)' WHEN 12 THEN 'Call a stored procedure' WHEN 15 THEN 'Select' WHEN 16 THEN 'Prep. and open (DB2 Connect only)' WHEN 17 THEN 'Prep. and execute (DB2 Connect)' WHEN 18 THEN 'Compile (DB2 Connect only)'

END AS STMT_OPERATION, TXT.STMT_TEXT, OP.STMT_ID, OP.STMT_TEXT_ID, OP.AGENT_ID, OP.NODE_NUMBER

FROM

PWH.EVM_STMT_OPERATIONS AS OP LEFT OUTER JOIN PWH.EVM_STMT_TEXTS AS TXT ON OP.STMT_TEXT_ID = TXT.STMT_TEXT_ID AND OP.LL_ID = TXT.LL_ID

WHERE

OP.LL_ID = :ll_id AND OP.APPL_ID in (':appl1', ':appl2')

ORDER BY

OP.START_TIME

Page 66: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software66

Scenario 2: Finding the cause of a deadlockAnalyzing the collected SQL Activity data by running a query

Continue on the next page...

32 Right-click pedemo deadlock SQL details and click Execute to run the query that you have just defined.

33 Before the query can be executed, the correct execution log and the application IDs of the application involved in the deadlock have to be specified.Click Time for the execution log number.

Page 67: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software67

Scenario 2: Finding the cause of a deadlockAnalyzing the collected SQL Activity data by running a query

Continue on the next page...

34 Write down the number (11) of the step log of the collected data. The start and end times help you identify the correct time frame. This number specifies the execution log of the collected SQL activity data.Click Variables.

35 The variables that are contained in the query SQL statement have to be specified in this window.

Type the number of the step log as the value for :ll_id.Paste in the application IDs that you copied into a text document in step 23 of this scenario. – The order is arbitrary.Click Execute.

Page 68: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software68

Scenario 2: Finding the cause of a deadlockAnalyzing the collected SQL Activity data by running a query

36 The result table shows you the sequence of the SQL statements that are involved in the deadlock.This allows you to analyze the reason for the deadlocks and enables you to change the SQL. – You can see that the two applications are accessing the same two tables at the same time and therefore lock each other.

37 You can save this information and, for example, send it to the developer of the applications so that the applications can be analyzed.Click Save.

You have successfully detected and analyzed a deadlock problem.

Page 69: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software69

Scenario 2: Finding the cause of a deadlock

In this scenario, you have learned how to:

Configure and activate event and exception processing. Collect SQL activity data with the help of Performance Warehouse

reports. Analyze collected data with Performance Warehouse queries.

Page 70: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software70

Cleaning up your system after the tutorial – Part 1of 3

Stop the demo activitySeven Command Prompt windows have been opened during the tutorial: six windows that update the monitor switches and one window that displays the current demo activity.To stop the demo activity:

Return to the Command Prompt window that displays the demo activity and press Ctrl+C.

The console prompts you with Terminate Batch job (Y/N)? Type Y and press Enter.

Type exit and press Enter to close the Command Prompt window.

In the other six Command Prompt windows for the monitor switches, type exit or click the Close button.

Page 71: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software71

Cleaning up your system after the tutorial – Part 2 of 3

Exit DB2 Performance Expert Client In Performance Expert Client, press Ctrl+Q.

If there are tasks running on Performance Expert Server, you are asked whether to you want to stop or continue them. Select Stop running tasks and click Yes.

Stop DB2 Performance Expert Server On your Windows system, select Start Programs IBM DB2

Performance Expert Server V2 Stop Performance Expert Server.

Page 72: IBM Software Group ® DB2 Performance Expert for Multiplatforms Version 2.1 Step-by-step tutorial.

IBM Software Group | DB2 Information Management Software72

Cleaning up your system after the tutorial - Part 3 of 3

Uninstall DB2 Performance Expert Client and Server On Windows XP:

• Select Start Control Panel Add/Remove Programs. On Windows 2000:

• Select Start Settings Control Panel Add/Remove Programs Select IBM DB2 Performance Expert Client and click Remove.

• Follow the instructions of the uninstallation wizard. Select IBM DB2 Performance Expert Server and click Remove.

• Follow the instructions of the uninstallation wizard.

• Select Invoke the unconfiguration utility when you are asked during uninstall.

Remove the PEDEMO database Open a Command Prompt window.

Type db2cmd.

In the new window, type db2 drop database pedemo and press Enter.