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.
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.
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.
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.
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.
This action might not be possible to undo. Are you sure you want to continue?