Topics for configuring for IOQWT for DB2 LUW 3.1.1


Configuring DB2 for Linux, UNIX, and Windows databases for use with IBM InfoSphere Optim Query Workload Tuner

You must configure your DB2® for Linux, UNIX, and Windows database before you start tuning SQL statements.

The following objects are created on the database during the configuration process:

The license for InfoSphere Optim Query Workload Tuner
If you are using the IBM Data Studio full client, Version 3.1.1, and the IBM InfoSphere Optim Query Workload Tuner for DB2 for Linux, UNIX, and Windows License Activation Kit, Version 3.1.1 is installed on your workstation, you can activate the product license on the database. You can activate the license either by running a script or by configuring the database by using the IBM Data Studio full client.
EXPLAIN tables
You can create a set of EXPLAIN tables manually by running a script, or you can let the IBM Data Studio client create a set in the SYSTOOLS schema.
QT_WCC* tables in the SYSTOOLS schema
These tables store information about query workloads.
The DB2OE.CALLDB2ADVIS stored procedure
This stored procedure allows the Index Advisor and the Workload Index Advisor to recommend new indexes.
The OQT.WCC_EXPLAIN_SP stored procedure
This stored procedure gathers EXPLAIN information for the SQL statements that are in query workloads.

Configuring DB2 databases for query and query-workload tuning by using the IBM Data Studio client, Version 3.1.1

You can configure DB2 for Linux, UNIX, and Windows databases for use the IBM InfoSphere Optim Query Workload Tuner by using the IBM Data Studio client, Version 3.1.1.

Before you begin

Recommendation:
In the DB2 for Linux, UNIX, and Windows database that you are configuring, create a system temporary table space with a page size of 8 KB or larger to avoid potential query tuning errors.

About this task

During configuration, when InfoSphere Optim Query Workload Tuner creates the EXPLAIN tables and the EXPLAIN_GET_MSGS user-defined function, it grants the EXECUTE privilege on the EXPLAIN_GET_MSGS user-defined function to PUBLIC.

Procedure

To configure a DB2 for Linux, UNIX, and Windows database for query tuning with InfoSphere Optim™ Query Workload Tuner:

  1. In the Data Source Explorer, right-click the connection to the database and select Connect.
  2. Expand the connection by clicking the plus symbol next to it. An icon that represents the database appears. Right-click the database and select Analyze and Tune > Configure for Tuning > Guided Configuration.

    The client detects whether a license for IBM InfoSphere Optim Query Workload Tuner, Version 3.1.1 is active on the database.

    If there is an active license on the database, the client attempts to configure the database for query tuning and query-workload tuning.

    If there is no active license on the database, your choice of action depends on which of the three following situations match your own situation:

    If the client returns a message that EXPLAIN tables must be dropped or migrated, follow the instructions in the message.

  3. Verify that the database is configured for query and query-workload tuning and that the required data objects are created or enabled.
    1. In the Data Source Explorer, right-click the database, and then click Analyze and Tune > Configure for Tuning > Advanced Configuration and Privilege Management. The Advanced Configuration and Privilege Management window opens.
    2. In the Configuration Status section, you can check the status of the tables, stored procedures, objects, and automatic statistics collection that are required to use the query and query-workload tuning features. If a data object is disabled, follow the instructions in the message that is displayed beside that object to create or enable it.

Results

Your DB2 for Linux, UNIX, and Windows database is configured for query and query-workload tuning with InfoSphere Optim Query Workload Tuner.

What to do next

To start tuning in the Query Tuner Workflow Assistant, right-click the connection in the Data Source Explorer, then click Analyze and Tune > Start Tuning.

Authorities and privileges for configuring DB2 for Linux, UNIX, and Windows databases for use with IBM InfoSphere Optim Query Workload Tuner

Ensure that you have the authorities and privileges that are required to configure a DB2 for Linux, UNIX, and Windows database.

You must have the following authorities and privileges to configure a DB2 for Linux, UNIX, and Windows database for query tuning:

Migrating EXPLAIN tables

If you upgraded the version of DB2 for Linux, UNIX, and Windows that is managing a database, and that database contains a set of EXPLAIN tables that you are using with IBM InfoSphere Optim Query Workload Tuner, you can run a script to migrate those tables so that they are compatible with the new version of DB2 for Linux, UNIX, and Windows.

To migrate the EXPLAIN tables, follow the instructions in the migrate_explaintables_db2luw.ddl migration script.

You can find this migration script in these locations in the installation directory for the IBM Data Studio client.

Running scripts to configure DB2 databases for use with IBM InfoSphere Optim Query Workload Tuner

If you do not want to use the IBM Data Studio client to configure a DB2 for Linux, UNIX, and Windows database, you can carry out the configuration by editing and running a number of scripts.

Before you begin

Ensure that you have the required authorities and privileges to configure a DB2 for Linux, UNIX, and Windows database and activate the license for InfoSphere Optim Query Tuner.

Procedure

  1. Run the file EXPLAIN.DDL on the database that you want to use for tuning SQL. This file is located in the MISC folder in your DB2 installation.
  2. If you are using the IBM Data Studio full client, Version 3.1.1, the IBM InfoSphere Optim Query Workload Tuner for DB2 for Linux, UNIX, and Windows, Version 3.1.1 License Activation Kit is installed on your workstation: Run the file License.bat (for Windows systems) or License.sh (for Linux systems), which is in the directory <IBM Data Studio installation directory>\QueryTunerServerConfig\all_features\LUW\License\, to activate the product license on the database.
    1. In a DB2 command window, connect to the database on which you want to activate the license.
    2. Change to the directory in which the License.bat (for Windows systems) or License.sh (for Linux systems) file is located.
    3. Run the file with the db2 -vtf command.
  3. In a text editor, edit the file luwsp.sql, which is in the directory <IBM Data Studio installation directory>\QueryTunerServerConfig\all_features\LUW\IA\, by replacing the $install variable with the absolute path to this file. You do not need to run the file after you edit it. In a later step, you will run a batch file that will run this file.
  4. In a text editor, edit the file wccexplainsp.sql, which is in the directory <IBM Data Studio installation directory>\QueryTunerServerConfig\all_features\LUW\WCC\, by replacing the $install variable with the absolute path to this file. You do not need to run the file after you edit it. In a later step, you will run a batch file that will run this file.
  5. Open an DB2 command window, connect to the database that you activated the license on, and change to the directory <IBM Data Studio installation directory>\QueryTunerServerConfig\all_features\LUW\.
  6. Run the file enablement_win.bat (on Windows systems) or enablement_LinuxUnix.sh (on Linux systems).
  7. Check these output files in the current directory for errors: luwsp.out, oqt_profile.out, wccexplainsp.out, and wccluwddl.out

What to do next

To start tuning in the Query Tuner Workflow Assistant, right-click the connection in the Data Source Explorer, then click Analyze and Tune > Start Tuning.

Recommendation:
In the DB2 for Linux, UNIX, and Windows database that you are configuring, create a system temporary table space with a page size of 8 KB or larger to avoid potential query tuning errors.