Finding Your DB2 Version

Do you know how to determine what version of DB2 you're using? It's not intuitive. DB2 has commands horrible enough you could use them to scare children, like "rewind tape."

But sometimes you need to know the version immediately, nobody knows what it is or how to find it, and even worse, they are unable to give you the necessary permissions. Life is hard when you have to deal with BOFHs ;-).

There are a couple of methods you can use to determine the version of DB2. Why not just learn one? Or even better, bookmark this article. No more cursing, just bookmark it.

Method #1. Connect to the database from the command line and read the herald message:


$ db2 connect to mydb

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.1
 SQL authorization ID   = DB2INST5
 Local database alias   = AOL_MM

 

Method #2. Retrieve the version from the system table:


$ db2 "select * from SYSIBM.SYSVERSIONS"
VERSIONNUMBER VERSION_TIMESTAMP          AUTHID   VERSIONBUILDLEVEL             
------------- -------------------------- -------- -----------------
9070100       2011-10-10-14.38.42.064608 DB2INST5 s091114                       

  1 record(s) selected.

 

Method #3. Get the version directly using the 'db2level' command:


$ db2level
DB21085I  Instance "db2inst5" uses "64" bits and DB2 code release "SQL09071" 
with level identifier "08020107".
Informational tokens are "DB2 v9.7.0.1", "s091114", "IP23034", and Fix Pack "1".
Product is installed at "/opt/ibm/db2/V9.7".

 

Method #4. The Database Manager snapshot, among other interesting information, also contains the version:


$ db2 get snapshot for dbm | grep -P "(Product name|Service level)"

Product name                                   = DB2 v9.7.0.1
Service level                                  = s091114 (IP23034)


 

You're welcome. :-)

Vertabelo