Rational Data Architect and DB2 9: Storage Diagrams

Wednesday May 30th 2007 by Paul Zikopoulos
Share:

Paul Zikopoulos explores Database Explorer's storage diagramming feature--a tool for visualization of the underlying storage used for physical data objects.

In my latest articles, I’ve been writing about the IBM Rational Data Architect (Rational DA) integrated development environment (IDE), a tool that’s specifically designed for those involved in data server design and schema evolution. So far, I’ve shown you how to add a database connection, which becomes the basis from which all of your work is directed. In addition, I detailed how to build SQL statements using the SQL builder and the SQL editor, along with a bunch of really cool features that minimize design time errors and lead to faster and more robust deployments. In this article, I want to introduce you to another feature available from the Database Explorer view: storage diagrams.

The Database Explorer view: home of storage diagrams

Once you have an active database connection, you can do a lot of things with the Database Explorer view aside from just creating SQL statements. For this article, I assume you have an active database connection to the SAMPLE database and your Database Explorer view looks similar to the following example:

Storage diagrams

The storage diagramming feature is a useful tool that’s available directly from the Database Explorer view. Storage diagrams, as their name suggests, are visualizations of the underlying storage used for your physical data objects. Rational DA allows you to work with many vendors’ databases (including their storage objects), but you can only create storage diagrams for DB2 for z/OS, and DB2 for Linux, UNIX, and Windows data servers.

To add a storage diagram that illustrates the storage model for your database, perform the following steps:

1.  Right-click Storage Diagrams and select Add Storage Overview Diagram. The Select Elements window opens.

2.  Select the table spaces you want the diagram to include in the Select Elements window and optionally include more detailed information in the diagram such as related tables, buffer pools, and partition groups, by selecting their corresponding check boxes:

Click for larger image

In the previous figure, you can see that I chose to visualize the main non-system default table spaces that are automatically created when the SAMPLE database is created using the db2sampl –xml command. In addition, by selecting the Include related tables and Include related buffer pools check boxes, I include these objects in my storage diagram but not related partitioned groups (because this is a non-partitioned database).

Note:

Even when the Database Partitioning Feature (DPF) is not being used to create a partitioned database environment, the underlying architecture is still configured for it. This is why partition groups show up in the Database Explorer view as an optional component in any associated storage diagrams.

Based on these options, Rational DA creates a storage diagram that looks like this:

You can see that the default layout that Rational DA uses when a large number of objects are included in a storage diagram can be pretty hard to read. Thankfully, Rational DA provides some good features to help you work with larger diagrams.

First, you can use the Outline view. (If you don’t see it, open it by selecting Windows->Show View->Outline, or just press Alt+Shift+Q,O). The Outline view for this storage diagram is shown below:

In this mode, the Outline view can be used as a magnifying glass for the designer canvas. Simply move the viewer box over the shaded lines (those are objects in the storage diagram) and watch the designer canvas as it shows the objects in the Outline view’s magnifying box:

 

The Outline view also has a perspective that lets you navigate the objects in a hierarchical tree. You can change to this perspective by selecting the Node icon (the one to the left of the magnifying perspective), as shown below.

The hierarchical view shows the same information but in a different format, as shown below:

Personally, I like to work in the hierarchical view because it allows me to see the names of all the objects in the diagram, and when I find one I want more details on, I simply click it and the canvas automatically navigates to it. This saves having to scroll around in the magnifying view until I stumble on the object I’m interested in. You’ll develop your own preferences that are related to your schema, and indeed the magnifying view provides some benefits when working with very large diagrams, but the point is you have the flexibility to choose the visualization method that’s best for your schema.

3.  Close the visualization diagram by clicking the button in its name tab:

4.  Using the previous steps outlined in this article, create a new storage diagram that doesn’t contain as many objects. To make things easier, select a single table space, and preferably one that doesn’t have a lot of objects in it. For this example, you might want to use the following data definition language to ensure that you have a table space with a small number of objects.

CREATE LARGE TABLESPACE DATABASEJOURNAL
CREATE TABLE EMPLOYEEDJ LIKE EMPLOYEE in 
  DATABASEJOURNAL
CREATE TABLE DEPARTMENTDJ LIKE DEPARTMENT in 
  DATABASEJOURNAL

Using the previous DDL should produce a storage diagram that looks like this:

 

Note:

You might have to select Storage Diagrams->Refresh to refresh the schema cache after adding objects to your database connection to make them show up in the Database Explorer view.

5.  Select each object in the new storage diagram, and click Properties to see specific details on each object:

In the previous figure, you can see that the properties of each object vary and are categorized by Rational DA using sub-tabs (shown highlighted). Explore these tables and their associated properties to get a sense of all the information that you can find out about the storage objects in your database using Rational DA.

6.  Select any object in your storage diagram and right-click to see the storage diagram object’s pop-up menu:

This pop-up menu is the same for any object you select in a storage diagram and contains the following options:

  • Add Note – Allows you to add a note describing the selected object in the storage diagram. Unlike the Property tab’s Documentation tab, this information is placed on the design canvas. For example:

    Before you enter the text for a note, you should size it using its control handles (the black squares in the previous figure). The note text you type automatically fits within the defined box. Pressing Enter in a note box doesn’t result in a carriage return; rather it tells Rational DA that you have finished typing the note.

  • Navigate – Instantly changes focus from the selected object in the designer canvas to the location of the object in the Database Explorer view for subsequent action. This is a very convenient feature when you need to work with the objects in your storage diagram – especially if that diagram, and the schema it represents, is very large.

  • File->Save Image Map - Allows you to save the image map to a file system as one of the following formats: GIF, BMP, JPEG, or SVG. For example:

    Once the image map is saved to disk, you can work with it like a regular file. The SVG format saves the storage diagram into an XML format that can be used from other facilities (beyond the scope of this article) in Rational DA:

  • Edit - Provides basic editing functions such as copy, cut, paste, undo, and redo operations.

  • Delete from Diagram – Deletes an object from a storage diagram.

  • Format – Provides various visual controls over the formatting of objects in the storage map. For example, you can select to make the color of buffer pool objects green for easier identification.

    The previous figure shows some of the many formatting options that you can use to control the visualization effects of the objects in a storage diagram.

  • Filters – Allows you to filter information about a selected object within the storage map. In this article, I didn’t cover the information that’s displayed by default for the objects in a storage map; I’ve left that for you to discover. However, filtering allows you to control what information is displayed.

    For example, the DATABASEJOURNAL table space looks like:

    You can click the highlighted toggle control () in the previous figure to hide, or show, default information.

    If you don’t want to toggle information, you can filter it. For example, perhaps you never need access to the actual path location of the DATABASEJOURNAL table space’s container. You can hide it using the toggle control, but this wastes space on the image map when you have a large number of attributes associated with an object. In contrast, filtering it removes the toggle and gives you more landscape on the canvas. For example, filtering allows you to avoid objects that look like this:

    Rational DA gives you a number of filters for objects within a storage map, as well as controls for how the information is displayed.

    For example, you might want to include a schema name along with its associated object names, as shown below:

  • Show Properties View – Quickly shifts focus to the Properties view that was detailed earlier in this article. What’s nice about this feature is often you may be working without this part of the IDE in plain view, and this option provides a quick method by which you can get to the an object’s properties in a timely manner.

When you right-click on the designer canvas without selecting an object, you get a similar pop-up menu that has some additional features. I’m not going to cover them here (because I want you to experiment), but ones that haven’t already been mentioned in this article are illustrated in the following figure:

 

One last thing: the palette

The palette contains a number of objects that you can use to further illustrate the storage diagram. Some of these have already been covered such as notes and lines, and so on. The palette offers even more flexibility and customization possibilities. Again, I’ll let you experiment with these objects. I altered my storage diagram to look like this:

Wrapping it all up

In this article, I showed you how to create and customize storage diagrams using the Database Explorer view. Storage diagrams are terrific communication vehicles that are not only useful within the data server team but also really shine when used across the entire IT organization. In my next article, I will show you the rest of the features available in the Database Explorer view.

» See All Articles by Columnist Paul C. Zikopoulos

About the Author

Paul C. Zikopoulos, BA, MBA, is an award-winning writer and speaker with the IBM Database Competitive Technology team. He has more than ten years of experience with DB2 and has written more than one hundred articles and several books about it. Paul has co-authored the books: Information on DB2 9 New Features, Demand: Introduction DB2 9 New Features, DB2 Version 8: The Official Guide, DB2: The Complete Reference, DB2 Fundamentals Certification for Dummies, DB2 for Dummies, and A DBA's Guide to Databases on Linux. Paul is a DB2 Certified Advanced Technical Expert (DRDA and Cluster/EEE) and a DB2 Certified Solutions Expert (Business Intelligence and Database Administration). In his spare time, he enjoys all sorts of sporting activities, running with his dog Chachi, and trying to figure out the world according to Chloë – his new daughter. You can reach him at: mailto:paulz_ibm@msn.com.

Trademarks

IBM, DB2, Rational, and z/OS are registered trademarks of International Business Machines Corporation in the United States, other countries, or both.

Windows is a trademark of Microsoft Corporation in the United States, other countries, or both.

UNIX is a registered trademark of The Open Group in the United States and other countries.

Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.

Other company, product, and service names may be trademarks or service marks of others.

Copyright International Business Machines Corporation, 2007. All rights reserved.

Disclaimer

The opinions, solutions, and advice in this article are from the author’s experiences and are not intended to represent official communication from IBM or an endorsement of any products listed within. Neither the author nor IBM is liable for any of the contents in this article. The accuracy of the information in this article is based on the author’s knowledge at the time of writing.

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved