Lists the DB2® products
and features installed on your Linux and UNIX systems,
including the DB2 HTML documentation.
With the ability to install multiple copies of DB2 products on your system and the flexibility
to install DB2 products and
features in the path of your choice, you can use the
db2ls command
to list:
- where DB2 products are installed
on your system and list the DB2 product
level.
- all or specific DB2 products
and features in a particular installation path.
The db2ls command can be found
both in the installation media and in a DB2 install
copy on the system. The db2ls command can be run
from either location. The db2ls command can be
run from the installation media for all products except IBM® Data
Server Driver Package.
Command
syntax
>>-db2ls-------------------------------------------------------->
>--+-----------------------------------------------------------+-->
'- -q--+--------------------------+-- -b--base-install-path-'
+- -f--feature-rsp-file-ID-+
+- -a----------------------+
'- -p----------------------'
>--+-----+--+---------------+----------------------------------><
'- -c-' '- -l--log-file-'
Command parameters
- -q
- Signifies that the query is to list installed DB2 products and features. By default, only the
visible components (features) are displayed unless the -a parameter
is also specified.
- -f feature-rsp-file-ID
- Queries for the specific feature, if it is installed. If it is
not installed, the return code from the program is nonzero, otherwise
the return code is zero.
- -a
- Lists all hidden components as well as visible features. The db2ls command
only lists visible features by default.
- -p
- Lists products only. This will give a brief list of which products
the customer has installed rather than listing the features.
- -b base-install-path
- When using the global db2ls command in /usr/local/bin,
you need to specify which directory you are querying. The global db2ls command
will simply call the db2ls from that install path
and pass in the rest of the parameters.
- -c
- Prints the output as a colon-separated list of entries rather
than column-based. This allows you to programmatically with this information.
The first line of output will be a colon-separated list of tokens
to describe each entry. This first line will start with a hash character
("#") to make it easy to ignore programmatically.
- -l log-file
- Trace log file to use for debugging purposes.
Examples
- To query what DB2 database
features are installed to a particular path, issue:
db2ls -q -b /opt/ibm/ese/v9
- To see all DB2 database
features installed to a particular path, issue:
db2ls -q -a -b /opt/ibm/ese/v9
- To check whether a specific DB2 database
feature is installed or not, issue:
db2ls -q -b /opt/ibm/ese/v9 -f <feature>
Usage notes
- You cannot use the db2ls command on Windows operating systems.
- If the root has write permission in /usr/local/bin or
is able to create /usr/local/bin, the symbolic link /usr/local/bin/db2ls will
be created which points to DB2DIR/install/db2ls for
the first installation of DB2 Version
9 or later version installed on the system. The root will update the
link pointing to the highest version and level of DB2 installed on the system, if multiple copies
of DB2 are installed.
A non-root
installation will not create or change the
/usr/local/bin/db2ls.
In that case, to run
db2ls, you have to do one
of two things:
- add inst_home/sqllib/install to
the user's path. Then you can run db2ls as the
non-root user.
- pass in the exact path of the command, i.e., inst_home/sqllib/install/db2ls.
- The db2ls command is the only method to query
a DB2 product at Version 9 or
later. You cannot query DB2 products
using Linux or UNIX operating
system native utilities such as pkgadd, rpm, SMIT,
or swinstall. Any existing scripts containing a native
installation utility that you use to interface and query with DB2 installations will need to change.
- Different feature listings are obtained depending upon the root
versus non-root method of DB2 installation
and the user running the command.
Without the -q option:
- For any user, other than the non-root-install instance user, the
command displays all copies installed by the root user.
- For the non-root-install instance user, the command displays all DB2 copies installed by the root
user plus the non-root copy owned by the non-root user.
With the -q option:
- If userA wants to know if userB has DB2 installed,
userA can run db2ls -q -b $userBHomeDir/sqllib. If
userA has access permission, then the DB2 features
installed by userB will be displayed, otherwise, an error message
will be returned indicating that access permission was denied.
- If you run db2ls -q without the -b option,
the installed features in the install path where db2ls belongs
are displayed.
- If the directory is read-only, the db2ls command
cannot be linked to from the /usr/local/bin directory. If you are
running in a system workload partitions (WPARs) you can use the db2ls command
located in the installation image root directory to query a list of
installed copies.