The DB2_CLPPROMPT registry variable comes with associated variables that can be used to return information to the DB2 UDB CLP with respect to the current or default instance attachment and the currently connected (or default) database
Variables supported for CLP at runtime
| Variable | Value at runtime |
%ia |
If an instance attachment exists, the authid of the current instance attachment; otherwise a null string. |
%i |
If an instance attachment exists, the local alias of instance currently attached; if there isn't a local instance attachment, the value of the DB2INSTANCE or DB2INSTDEF registry variables; otherwise a null string. |
%da |
If a database connection exists, the authorization ID of the current database connection; otherwise a null string. |
%d |
If a database connection exists, the local alias of database currently connected; otherwise the value of the DB2DBDFT registry variable; otherwise a null string. |
%n |
A newline character. |
For example if you want to set your db2 prompt to display the current instance name and the database name, set the DB2_CLPPROMPT as:
db2set DB2_CLPPROMPT=" (Instance:%i, Database:%d):"
The db2 clp prompt in this case will be something like (assuming db2 instance is DB2INST and database is PRDDB:
(Instance:DB2INST, Database:PRDDB)
DB2 CLP prompt customization using DB2_CLPPROMPT registry variable could help you prevent life threatening situations like running a drop table command on a production box instead of a test box.
If you want more information about this registry variable and customizing the db2 command line prompt in general, you may find this article on IBM developerworks interesting.
| Comments |
|
Powered by !JoomlaComment 3.25





