Actually DB2TOP is a real-time tool, however many DBA’s don’t know that it can be run in REPLAY mode with captured session information. So, next time you have a big crisis with your database, you can capture all the data from db2top and do the analysis afterwards.
How to capture the data? Option -C to capture. Press N to create a file. The option “-m” to gather data during n minutes.
defidb2:db2dfi 4> db2top -C -m 10
[18:20:30] Starting DB2 snapshot data collector, collection every 2 second(s), max duration unlimited, max file growth/hour 100.0M, hit
[18:20:31] Writing to 'db2snap-DFI-AIX64.bin', should I create a named pipe instead of a file [N/y]?
You can also capture data on real-time, pressing “C”.
How to replay capture data? Option -f to indicate the file with the data collection:
> db2top -f db2snap-DFI-AIX64.bin
When you replay you could see the time/date when the data was gathered, and you can use db2top options on the normal way of use. Futhermore, you can skip entries during “n” seconds indicating as it follows:
> db2top -f db2snap-DFI-AIX64.bin +50