Monitoring with db2top in interactive mode commands

The db2top monitoring utility quickly and efficiently monitors a complex DB2® environment. It combines DB2 snapshot information from all database partitions and provides a dynamic, real-time view of a running DB2 system using a text-based user interface.

About this task

When you run db2top in interactive mode, you can issue the following commands:

A
Monitor either the primary or the secondary database in a HADR cluster.
a
Goto application details for agent (or restrict on agent on statement screen). The db2top command will prompt for the agent-id.
B
Display the main consumer of critical server resources (Bottleneck Analysis).
c
This option allows to change the order of the columns displayed on the screen. The syntax is in the form: 1,2,3,... where 1,2,3 correspond to the 1st, 2nd and 3rd columns displayed. These are the column numbers to use when specifying a sort criteria.
When you use the c switch key, a screen is shown specifying the order of the columns displayed on screen. The left part of the screen displays the default order and column numbers; the right part of the screen displays the current ordering. To change the order of the columns, enter the new column order in the text field at the bottom of the screen. Next, enter the relative column positions as displayed on the left, separated by commas. Not all columns need to be specified. This column ordering can be saved in $DB2TOPRC for subsequent db2top monitoring sessions by selecting w. You can sort and select in which order the columns are displayed on the screen. Valid keywords for column ordering in the .db2toprc file are:
  • sessions=
  • tables=
  • tablespaces=
  • bufferpools=
  • dynsql=
  • statements=
  • locks=
  • utilities=
  • federation=
b
Goto buffer pool screen.
C
Toggle snapshot data collector on/off.
d
Goto database screen.
D
Goto the dynamic SQL screen.
f
Freeze screen.
F
Monitor federated queries on the primary server.
G
Toggle graph on/off.
h
Go to Help screen
H
Goto the history screen
i
Toggle idle sessions on/off.
k
Toggle actual vs delta values.
l
Goto sessions screen.
L
Allows to display the complete query text from the SQL screen. Regular DB2 explain can then be run using e or X options.
m
Display memory pools.
o
Display session setup.
p
Goto the partitions screen.
P
Select db partition on which to issue snapshot.
q
Quit db2top.
R
Reset snapshot data.
s
Goto the statements screen.
S
Run native DB2 snapshot.
t
Goto table spaces screen.
T
Goto tables screen
u
Display active utilities and aggregate them across database partitions.
U
Goto the locks screen.
V
Set default explains schema.
w
Write session settings to .db2toprc.
W
Watch mode for agent_id, os_user, db_user, application or netname. Statements returned by the session snapshot (option l) will be written to agent.sql, os_user-agent.sql, db_user-agent.sql, application- agent.sql or netname-agent.sql. When issued from the dynamic SQL screen (option D), statements will be written to db2adv.sql in a format compatible with db2advis.
X
Toggle extended mode on/off.
z|Z
Sort on ascending or descending order.
/
Enter expression to filter data. Expression must conform to regular expression. Each function (screen) can be filtered differently. The regexp check is applied to the whole row.
<|>
Move to left or right of screen.

The following switches apply to the applications screen only:

r
Return to previous function.
R
Toggle automatic refresh.
g
Toggle graph on/off.
X
Toggle extended mode on/off.
d
Display agents.
To start db2top in interactive mode, issue the following command:
db2top -d <database name>
When you type
db2top -d sample
the following output is displayed:
[\]11:57:10,refresh=2secs(0.000) Inactive,part=[1/1],<instanceName>:sample
[d=Y,a=N,e=N,p=ALL] [qp=off]

[/]: When rotating, it means that db2top is waiting between two snapshots, otherwise, it means db2top is waiting
     from an answer from DB2
11:57:10: current time
refresh=2secs: time interval
refresh=!secs: Exclamation mark means the time to process the snapshot by DB2 is longer than the refresh interval.
     In this case, db2top will increase the interval by 50%. If this occurs too often because the system is too busy,
     you can either increase the snapshot interval (option I), monitor a single database partition (option P), or turn
     off extended display mode (option x)
0.000 : time spent inside DB2 to process the snapshot
d=Y/N : delta or cumulative snapshot indicator (command option -k or option k).
a=Y/N : Active only or all objects indicator (-a command option set or i)
e=Y/N : Extended display indicator
p=ALL : All database partitions
p=CUR: Current database partition (-P command option with no partition number specified)
p=3 : target database partition number: say 3

Inactive: : Shows inactive if DB2 is not running, otherwise displays the platform on which DB2 is running
part=[1/1] : active database partition number vs total database partition number. For example, part=[2,3] means one
      database partition out of 3 is down (2 active, 3 total) 
<instanceName> : instance name
sample : database name

Example

The following example demonstrates running the db2top monitoring utility in interactive mode in a partitioned database environment:

db2top -d TEST -n mynode -u user -p passwd -V skm4 -B -i 1
The command parameters are as follows:
-d TEST     # database name
-n mynode   #  node name
-u user     #  user id
-p passwd   #  password
-V skm4     #  Schema name
-B          #  Bold enabled
-i 1        #  Screen update interval: 1 second