Detecting indexes, tables and packages not used on DB2

DB2, from version 9.7, allows to know easily what indexes are not being used in a Database. The query is also for tables and packages.

This is a useful tool for tuning indexes and detecting problems in their use.

After version 9.7 DB2 includes a new LASTUSED field in the SYSCAT.INDEXES, SYSCAT.TABLES and SYSCAT.PACKAGES tables.

This field indicates the date of last use of indexes, tables or packages.

For example, to query unused indexes since 1/1/2019, you could use this simple query:

Tuning DB2: Snapshots

To tune a database is useful to create snapshots that capture information from different structures/components of the instance.

In this post we show how they can be used to perform an analysis of tuning.

First of all, the monitor switches must be on to collect data from the different structures.

The state monitors are available as follows:

How to know the DB2 connection port

Maybe there are other methods, in this short article, a simple way to know the port that serves DB2 server.

We get the name of the service TCP / IP:

> db2 get dbm cfg | grep SVCENAME

Capture the result:

TCP/IP Service name (SVCENAME) = db2TRP

Look at /etc/services:

> cat /etc/services | grep sapdb2QRP

db2TRP 5912/tcp # DB2 Communication Port

 

The listening port is 5912!