Each event monitor and any application using the snapshot monitor APIs has its own logical view of the DB2 monitor data and switches. This means that when counters are reset or initialized, it only affects the event monitor or application that reset or initialized them.
Event monitor data cannot be reset, except by turning the event monitor off, and then on again.
An application taking snapshots can reset its view of the counters at any time by using the RESET MONITOR command.
When issuing its first snapshot API, an application inherits the default settings from the database manager configuration. For example, assuming that the statement switch was set in the database manager configuration file:
db2 update dbm cfg using DFT_MON_STMT on db2start
Issuing a GET MONITOR SWITCHES command for a single node system
db2 get monitor switches
will show that the statement switch is ON.
Monitor Recording Switches Switch list for node 1 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = ON 05-25-1997 10:44:34.820446 Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF
Turning OFF the statement switch from the command line will only affect the application issuing the command. The statement switch will still be ON for other applications (unless they have also turned it OFF). For example:
db2 update monitor switches using STATEMENT OFF DB20000I The UPDATE MONITOR SWITCHES command completed successfully
Then query your application's switches.
db2 get monitor switches
Monitor Recording Switches Switch list for node 1 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = OFF Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF
Querying the database manager switches will show that the update did not affect its settings:
db2 get database manager monitor switches
DBM System Monitor Information Collected Switch list for node 1 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = ON 05-25-1997 10:44:34 Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF
Issuing a global GET MONITOR SWITCHES command for a partitioned database returns switch information for each node in the system
db2 get monitor switches global
will show that the statement switch is ON.
Monitor Recording Switches Switch list for node 0 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = ON 05-25-1997 10:44:34.820446 Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF Switch list for node 1 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = ON 05-25-1997 10:44:34.820446 Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF Switch list for node 2 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = ON 05-25-1997 10:44:34.820446 Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF
An application can turn off the statement switch for all nodes (global) or for a single node. This will only affect the application issuing the command. The statement switch will still be ON for other applications (unless they have also turned it OFF). For example:
db2 update monitor switches using STATEMENT OFF AT NODE 1 DB20000I The UPDATE MONITOR SWITCHES command completed successfully
Then query your application's switches.
db2 get monitor switches global
Monitor Recording Switches Switch list for node 0 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = ON 05-25-1997 10:44:34.820446 Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF Switch list for node 1 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = OFF Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF Switch list for node 2 Buffer Pool Activity Information (BUFFERPOOL) = OFF Lock Information (LOCK) = OFF Sorting Information (SORT) = OFF SQL Statement Information (STATEMENT) = ON 05-25-1997 10:44:34.820446 Table Activity Information (TABLE) = OFF Unit of Work Information (UOW) = OFF
When a monitoring application turns off a monitor switch or resets a data element counter, the DB2 server does not reset its own internal counters. Instead, it reinitialize the private logical view for that user. Other monitoring applications or event monitors are not affected.
You must have SYSADM, SYSCTRL, or SYSMAINT authority to use the UPDATE MONITOR SWITCHES command. See Command Reference for information on this command.
The database manager keeps track of all the applications using the snapshot monitor APIs and their switch settings. If a switch is set in its configuration, then the database manager always collects that monitor data. If a switch is OFF in the configuration, then the database manager will collect data as long as there is at least one application with this switch turned ON.
Internally, event monitors also use switches to instruct the engine as to which data should be collected. However, this is an implementation issue, and the switch settings for a particular event monitor cannot be queried.
An actual DBMS monitor switch is set as long as at least one application or event monitor needs it, or if it is set in the configuration file.