Tip 1. Specify the word in your DB2 console.
While you come in to DB2 console. the console will display the prompt in this system. the default word of DBS console's prompt is DB2 =>. as you see, it is very plain, and can not give our more information about the current connection. but DB2 Command provide a way to change it. the console's prompt can be protected by the option of DB2 system environment. the option is db2_clpprompt. the value of this option is not set, therefore the word is DB2 =>. you can set the value of its as you want. for example db2set db2_clpprompt = 'SQL =>', then you will find the prompt of console is changed after you run DB2 command. it likes this 'SQL => '. the value can use some variable character which is pre-defined into db2set command like '% d',' % I ',' % a' and '%'
The explanation about them is blow:
% I the instance's name if you connected, otherwise is null.
% Ia the instance's authid if you connected, otherwise is null.
% D the database's name if you connected, otherwise is null.
% Da the database's authid if you connected, otherwise is null.
Sample
[Db2inst1 @ dxzq10 ~] $ Db2set db2_clpprompt = 'SQL =>'
[Db2inst1 @ dxzq10 ~] $ DB2
SQL =>
[Db2inst1 @ dxzq10 ~] $ Db2set db2_clpprompt = '% d @ % I =>'
[Db2inst1 @ dxzq10 ~] $ DB2
@ Db2inst1 => --- you have never connect any database, therefore the name of database is not given.
@ Db2inst1 => list database directory;
System database directory
Number of entries in the directory = 1
Database 1 entry:
Database alias = toolsdb
Database Name = toolsdb
Local Database directory =/home/db2inst1
Database Release level = d.00
Comment =
Directory Entry type = indirect
Catalog Database Partition Number = 0
Alternate Server Hostname =
Alternate server port number =
@ Db2inst1 => connect to toolsdb;
Database connection information
Database Server = DB2/Linux 9.7.1
SQL authorization id = db2inst1
Local Database alias = toolsdb
Toolsdb @ db2inst1 =>
Now after you connect the toolsdb database. the prompt is changed to be toolsdb @ db2inst1, And the 'toolsdb' is the database's name, and 'db2inst1' is the instance's name.
That's all. Enjoy it.