Popular Posts
For when a first initial is all you can remember
The -b option allows you to run db2top in “background mode”. In today’s post, we will examine what it means to run db2top in background mode and sample the various sub-options that let you customize background mode to your liking.
In background mode, instead of launching the usual text-based graphical user interface, db2top simply prints output to the console or to a file, depending on the sub-options you specify, and there are a lot of sub-options. First are all the different reports you can print:
You can specify only one of the above sub-options and it must be placed immediately after the -b. Specifying more than one option results in:
*************************************************************************
*** ***
*** Error: Multiple suboptions in background mode are not supported ***
*** ***
*************************************************************************
Failing to specify the sub-option immediately after the -b results in:
*************************************************************************
*** ***
*** Error: -b requires a valid suboption ***
*** ***
*************************************************************************
Specifying the -b more than once results in:
*************************************************************************
*** ***
*** Error: -b can only be invoked once ***
*** ***
*************************************************************************
In addition to a choice of one of the report options listed above, the -b option has six optional sub-options that you can specify in any order. These are:
Although in terms of the order in which they are specified on the command line they can come before or after -b option, specifying any one of these sub-options without also specifying -b results in an error message like the following for -X:
*************************************************************************
*** ***
*** Error: -X is only supported with the -b option ***
*** ***
*************************************************************************
or the following for -o file.out:
*************************************************************************
*** ***
*** Error: -o file.out is only valid for background mode ***
*** ***
*************************************************************************
Let’s look at each of the optional sub-options in turn:
db2top -d sample -b U -s 0DB2 inactive: 40Y.25d 04h:34m:45sTime;Agent_Id(State);Application_Name;Application_Status;Object_Name;Lock_Mode;Object_Type;Lock_Status;Lock_Count;Is_Blocker;Locked_By;Tablespace_NameExiting because of max samples reached(0), time since begin of collection=0 sec(s).
If instead, you specify the -D option, the separator in the output changes as below:
db2top -d sample -b U -s 0 -D @
DB2 inactive: 40Y.25d 04h:41m:54s
Time@Agent_Id(State)@Application_Name@Application_Status@Object_Name
@Lock_Mode@Object_Type@Lock_Status@Lock_Count@Is_Blocker
@Locked_By@Tablespace_Name
Exiting because of max samples reached(0), time since begin of collection=0 sec(s).
db2top -d sample -b U -s 0 -XDB2 inactive: 40Y.25d 04h:52m:54s<?xml version="1.0"?><Snapshot_stream database="sample">
<Locks_List time="23:52:54"></Locks_List></Snapshot_stream>/* 08:53:44.512548 */ select count(*) from syscat.views,syscat.views,syscat.views;
/* 08:53:48.700508 */ select count(*) from syscat.views,syscat.views,syscat.views;
Popularity: 11% [?]