Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

DB2 9 DBA exam 731 prep, Part 5: DB2 utilities

Get ready for the exam

Clara Liu (claraliu@ca.ibm.com), DB2 UDB Product Management, IBM
Clara Liu works as a DB2 UDB Product Planner at the IBM Toronto Laboratory. As a member of the DB2 product management team, she works closely with the DB2 marketing and development teams as well as customers and IBM business partners. She specializes in the area of database application development. Clara is also an active author in the DB2 for Linux, UNIX, and Windows community. She co-authored few IBM presses and one of her best sellers is Understanding DB2 - Learning Visually with Examples (Prentice Hall, 2004). You can reach Clara at claraliu@ca.ibm.com.

Summary:  Learn skills that help you to properly manage your DB2 database servers. This is the fifth in a series of seven tutorials to help you prepare for the DB2® 9 for Linux®, UNIX®, and Windows™ Database Administration (Exam 731).

View more content in this series

Date:  30 Jun 2006
Level:  Introductory PDF:  A4 and Letter (134 KB | 38 pages)Get Adobe® Reader®

Activity:  12602 views
Comments:  

DB2 Advisors

DB2 Design Advisor

The Design Advisor is a handy tool that can help you to determine what database objects can improve the performance of a given workload. A workload is basically a set of SQL statements for which the Design Advisor evaluates based on the characteristics of the workload, the characteristics of the database, and the hardware resources. It uses the DB2 optimizer, the database statistics, and the Explain mechanism to generate recommendations for new indexes, new materialized query tables (MQT), conversion to multidimensional clustering (MDC) tables, redistribution of tables, deletion of indexes and MQTs unused by the specified workload. You might be familiar with MQTs and MDCs. They are advanced database objects which are not covered in the DBA exam (731). If you are interested in advanced database objects, please refer to the DB2 Information Center.

You can start the advisor from the command line with the db2advis along with the necessary inputs. There are few ways to specify a workload using the db2advis command.

You can specify a single SQL statement when issuing the db2advis command. The following example evaluates the given SQL statements and makes recommendations accordingly.

db2advis -d sample -s "select * from employee where workdept='A00' and 
salary > 40000" -o output.out

You can use a set of dynamic SQL statements captured in a DB2 snapshot. To do so, you need to reset the database monitor with the command.

db2 reset monitor for database database-name
                

Let your application run for a desired period of time and allow DB2 snapshots to capture the dynamic SQL statements. Issue the following db2advis command to evaluate the workload and make recommendations. Here the -g option tells the design advisor to get the SQL statements from the dynamic SQL snapshots. In addition, the -p option causes the captured SQL statements to be stored in the ADVISE_WORKLOAD system tables.

db2advis -d sample -g -p -o output.out

Alternatively, you can create a workload file containing a set of SQL statements. Set the frequency of the statements in the workload. Here is a sample workload file.

					
--#SET FREQUENCY 100
SELECT COUNT(*) FROM EMPLOYEE;
SELECT * FROM EMPLOYEE WHERE LASTNAME='HAAS';
--#SET FREQUENCY 1
SELECT * FROM EMPLOYEE WHERE WORKDEPT='A00' AND SALARY > 40000;

Then, simply run the db2advis command with the -i option.

db2advis -d sample -i input.sql -o output.out

The Design Advisor can also be started from the Control Center. Select the database you want to work with, Select Design Advisor from its pop-up menu. You will get the Design Advisor as shown here.

As you step through the tool, you can import a SQL workload, make changes to the SQL statements, update statistics for certain tables, choose to evaluate the workload now, and etc.

9 of 12 | Previous | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=145780
TutorialTitle=DB2 9 DBA exam 731 prep, Part 5: DB2 utilities
publish-date=06302006
author1-email=claraliu@ca.ibm.com
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.