Systems Engineering and RDBMS

Archive for March 10th, 2007

DB2 LUW Registry variables – How to set and view them.

Posted by decipherinfosys on March 10, 2007

DB2 provides a number of registry and environment variables which we can set, unset and/or view using the db2set command.

Setting registry variable:

Following command can be used to set up value of DB2COMM registry variable at global level:

db2set -g DB2COMM=TCPIP

Execute following command to check whether value is set or not:

db2set -g DB2COMM

C:\Program Files\IBM\SQLLIB\BIN>db2set -g DB2COMM

TCPIP

If we setup the registry variable without any value, it will actually unset the variable. For example, to unset the value of DB2COMM parameter we set earlier, use following command.

db2set -g DB2COMM=

Check the output by issuing following command. It is followed by output.

C:\Program Files\IBM\SQLLIB\BIN>db2set -g DB2COMM

DBI1303W Variable not set.

Explanation:

The variable was not set in the profile registry.

User Response:
No further action is required.
Viewing registry variable:

To view all currently set registry variables, use command db2set -all.

C:\Program Files\IBM\SQLLIB\BIN>db2set -all

[e] DB2PATH=C:\Program Files\IBM\SQLLIB
[i] DB2ACCOUNTNAME=FREEDOM\db2admin
[i] DB2INSTOWNER=FREEDOM
[i] DB2PORTRANGE=60000:60003
[i] DB2INSTPROF=C:\PROGRA~1\IBM\SQLLIB
[i] DB2COMM=TCPIP
[g] DB2_EXTSECURITY=NO
[g] DB2SYSTEM=FREEDOM
[g] DB2PATH=C:\Program Files\IBM\SQLLIB
[g] DB2INSTDEF=DB2
[g] DB2ADMINSERVER=DB2DAS00

Here:
[e] is for environment variable,
[i] for instance level registry,
[g] for global level registry and
[n] for instance node level registry

REG_LIST_VARIABLES Table Function:

DB2 also introduced table function REG_LIST_VARIABLES, which returns registry settings currently being used by the database against which this table function is executed. Here is the command followed by the result. You can run it either from command center or from the command line editor.

SELECT reg_Var_name, reg_var_value, level
FROM table(REG_LIST_VARIABLES()) as reg;

REG_VAR_NAME REG_VAR_VALUE LEVEL
———— ————- —–
DB2ADMINSERVER DB2DAS00 G
DB2COMM TCPIP I
DB2INSTDEF DB2 G
DB2INSTPROF C:\PROGRA~1\IBM\SQLLIB I
DB2PATH C:\Program Files\IBM\SQLLIB E
DB2SYSTEM FREEDOM G
DB2PORTRANGE 60000:60003 I
DB2INSTOWNER FREEDOM I
DB2ACCOUNTNAME FREEDOM\db2admin I
DB2_EXTSECURITY NO G

Above result shows all the set registry and environment variables otherwise can be seen using db2set –all command. Level column indicates whether the registry variable is at global or instance level.

Registry variables are stored in DB2 profile registry. There are four different types of profile registry. For detailed understanding of each level profile, please visit the following link from IBM’s site. This link explains in detail about different level of profile registry, what registry and environment variable it contains and how variable can be set or unset for each profile.

Posted in DB2 LUW | Leave a Comment »