DB2 Commands: db2level

Posted by

DB2 “commands” are not available via SQL. They are separate commands that when we had a shelf of books instead of the Info Center were available in the “Command Reference”. Many of them are also in ~/sqllib/bin, though there can be other locations. Some are very simple while others are much more complicated.

What db2level Does

db2level is a command we use primarily to show what version of DB2 we’re on. In older versions of DB2, we had to use some of the numbers/letters that db2level returned to map that back to a specific FixPack, but these days they’ve made it easy by stating the FixPack outright.

Here is what db2level output looks like:

$ db2level
DB21085I  Instance "db2inst1" uses "64" bits and DB2 code release "SQL09074"
with level identifier "08050107".
Informational tokens are "DB2 v9.7.0.4", "s110330", "IP23243", and Fix Pack
Product is installed at "/opt/IBM/db2/V9.7".



The items in quotes are the real information being returned that changes based on the DB2 installation/instance.

The interesting information available from db2level includes:

  1. The name of the instance this information is for
  2. The bit-width of the instance – either 32 or 64 with very few 32-bit instance options left in DB2 9.7. Anything before version 8 can be assumed to be 32-bit, as 64-bit was only and experimental option on DB2 7
  3. Informational tokens that can be used to discern the distribution of DB2 and even what Operating System you’re running on. These will also change if you have a special build, so you can use them to determine if there are any special builds in place
  4. The specific offical FixPack you’re on.
  5. The path where this installation of DB2 is. (prior to version 9, this was not changeable, but on version 9 it is)

You can still use the numbers to map things back to a FixPack/OS if you really want to. Use this site:


And you can see that the above is 9.7 FixPack 4 – Build level:s110330

and it is Linux for AMD and INTEL – PTF IP23243

You Might Not Have Thought Of

db2level can be run as any user. If you haven’t executed the db2profile, then you’ll have to specify the whole path, but this can be very useful if you’re doing things like scripting a report of software versions and such, because you can get this information without having to be any specific user. Executed as root, it looks just like executing it as a privileged user:

# /opt/IBM/db2/V9.7/bin/db2level
DB21085I  Instance "db2inst1" uses "64" bits and DB2 code release "SQL09074"
with level identifier "08050107".
Informational tokens are "DB2 v9.7.0.4", "s110330", "IP23243", and Fix Pack
Product is installed at "/opt/IBM/db2/V9.7".

Other Ways to Get the Same Information


This requires a database connection.

$ db2 connect to sample

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.4
 SQL authorization ID   = DB2INST1
 Local database alias   = SAMPLE

$ db2 "select * from sysibmadm.env_inst_info with ur"

INST_NAME                                                                                                                        IS_INST_PARTITIONABLE NUM_DBPARTITIONS INST_PTR_SIZE RELEASE_NUM                                                                                                                      SERVICE_LEVEL                                                                                                                    BLD_LEVEL                                                                                                                        PTF                                                                                                                              FIXPACK_NUM
-------------------------------------------------------------------------------------------------------------------------------- --------------------- ---------------- ------------- -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -----------
db2inst1                                                                                                                                             1                1            64 08050107                                                                                                                         DB2 v9.7.0.4                                                                                                                     s110330                                                                                                                          IP23243                                                                                                                                    4

  1 record(s) selected.

ENV_INST_INFO administrative view – Retrieve information about the current instance


This requires instance owner on previous levels of db2, and some system level authority (SYSADM, SYSMAINT, SYSCTRL, or SYSMON)

$ db2pd -v

Instance db2inst1 uses 64 bits and DB2 code release SQL09074
with level identifier 08050107
Informational tokens are DB2 v9.7.0.4, s110330, IP23243, Fix Pack 4.


Lead Db2 Database Engineer and Service Delivery Manager , XTIVIA
Ember is always curious and thrives on change. Working in IT provides a lot of that change, but after 17 years developing a top-level expertise on Db2 for mid-range servers and more than 7 years blogging about it, Ember is hungry for new challenges and looks to expand her skill set to the Data Engineering role for Data Science. With in-depth SQL and RDBMS knowledge, Ember shares both posts about her core skill set and her journey into Data Science. Ember lives in Denver and work from home for XTIVIA, leading a team of Db2 DBAs.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.