Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
DB2 Command Line Processor Tips and Tricks

DB2 Command Line Processor Tips and Tricks

Ratings: (0)|Views: 999 |Likes:
Published by api-3701299

More info:

Published by: api-3701299 on Oct 15, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





DB2 Command Line Processor Tips and Tricks
by Paul C. Zikopoulos and Roman B. Melnyk

If you are an experienced database administrator (DBA) you likely use a mix
of graphical user interface (GUI) tools and the IBM\u00ae DB2\u00ae Universal
Database\u2122 (DB2 UDB) command line processor (DB2 CLP) to accomplish
your day-to-day tasks. In some cases, the difference between using a GUI or
the CLP is a cultural one: Windows\u00ae-based DBAs prefer to use a GUI
interface (for example, the DB2 Control Center), whereas Linux and UNIX\u00ae-
based DBAs often choose the DB2 CLP.

When business catch phrases like "time to value" or "flattened learning
curves" find their way into every aspect of a vendor's marketing campaign,
they always seem to revolve around the product's GUI. Sometimes lost,
though, are the little things that could help increase the productivity and
efficiency of DB2 CLP users.

Since the release of DB2 UDB Version 8.1, there have been some ease-of-use
enhancements to the DB2 CLP. The ability to customize the DB2 CLP
(interactive mode) was added in FixPak 1. The DB2 CLP was further
enhanced in Version 8.1.2 by adding plug-ins for your favorite text editors, as
well as a command cache. This article will detail these new features.

Customizing the DB2 CLP in Interactive Mode

DB2 UDB Version 8.1 with FixPak 1 adds the ability to have customizable DB2
CLP interactive prompts. You can use this feature to reflect the context of the
current instance attachment and database connection, and is a neat way for
DBAs to quickly and easily identify characteristics of their current
attachment. In the past, DBAs would have to repeatedly invoke CLP
commands (such as GET INSTANCE) to recall this information. The DB2 CLP
interactive prompt was hard coded and could not be changed, as shown

The new customization feature allows you to have the prompt reflect the
current user, current instance attachment, and database connection, among
others. The following example shows a customized interactive DB2 CLP
prompt that identifies userPAULZ, who is attached to theDB2 instance and
connected to theSAMPLE database.

To customize the command prompt, a new DB2 UDB registry variable called
DB2_CLPPROMPT was introduced. The DB2_CLPPROMPT registry variable can
be set to any text string that is 1 to 100 characters long. The customized
string can contain optional tokens that will be replaced at run time. The

information in the prompt is always displayed in uppercase characters,
regardless of how the options are configured, and if you change the settings,
the new values will not take effect until you restart the CLP.

You can set theDB2_CLP PROMPT registry variable in the DB2 UDB Profile
Registry using the DB2SET command, as shown below:
The following table lists the tokens that you can set:
The DB2 CLP Command Cache

In DB2 UDB Version 8.1.2, a DB2 CLP command cache was added to the
interactive runtime environment. This neat feature gives you the ability not
only to recall commands that you have entered in an interactive DB2 CLP
session, but to run them as well.

This feature is implemented through two new DB2 commands: HISTORY and
The HISTORY and RUNCMD Commands

The HISTORY command lets you access the contents of a cache, which, by
default, holds up to twenty 20 recently run commands in the same
interactive DB2 CLP session. The commands are returned with corresponding
sequence numbers that show the order in which the commands were run.
The most recently run command is listed last.

The size of the command history cache can be controlled using the
DB2_CLPHISTSIZE DB2 registry variable. The range of permissible values is 1
to 500, inclusive. If you set this variable to a value that is outside of this
range, the DB2 UDB CLP will use the default size of 20.
The syntax of the HISTORY command is shown below:
For example, note the order in which the commands in the following session
were entered:

Activity (5)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
colleen2010 liked this
madanasatish liked this
prasannars liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->