I need to know what is my database version.
I'm using DB2 V9.7 on linux 64 bits. I'm connected to a database and i need to know if it is 32 or 64 bits.
Can someone help me?
If you follow this link there are several ways. One of them shows you the architecture.
From that page:
$ db2level DB21085I Instance "db2inst5" uses "64" bits and DB2 code release "SQL09071" with level identifier "08020107". Informational tokens are "DB2 v126.96.36.199", "s091114", "IP23034", and Fix Pack "1". Product is installed at "/opt/ibm/db2/V9.7".
As Tom V's answer notes,
db2level is the simplest means of learning the version of a DB2 instance, but there are a couple of issues with it: firstly that one must have shell access to the server, and secondly, one must be careful that the appropriate
db2profile environment is sourced when running
db2level (it's entirely possible, even common in my experience, to have multiple versions of DB2 installed on a server). You can also use the
db2ls command to query all versions of DB2 installed on a server (I'm sorry, I can't recall which version introduced this command, but I'm pretty sure it was before the 9.x series).
To query the database version via SQL it is probably simplest to use the
SYSIBMADM.ENV_INST_INFO administrative view (that link is from the 9.7 reference so I'm sure it'll work in 9.7 although I no longer have access to that version to test with). This contains the column
INST_PTR_SIZE which will indicate whether the instance is 32 or 64 bits:
$ db2 "select inst_ptr_size from sysibmadm.env_inst_info" INST_PTR_SIZE ------------- 64 1 record(s) selected.
There are numerous other columns in that view which will also provide the instance version, and so on.
Finally, I would add that DB2 hasn't support 32-bit servers (except for development purposes) on UNIX systems since 9.1 (note: this does not apply to Linux with a 32-bit kernel or Windows, just AIX, HP-UX, etc). The relevant page is rather confusing though! Still the point is that if you know the server is Linux with a 64-bit kernel then the DB2 instance must be 64-bits (unless it's a pure development instance which won't have support).