System monitor switches control the collection of data
by the system monitor. By setting certain monitor switches to ON,
you can collect specific types of monitor data.
Before you begin
The application performing any monitor switch updates must
have an instance attachment. You must have one of SYSADM, SYSCTRL,
SYSMAINT, or SYSMON authority to use the following commands:
- UPDATE MONITOR SWITCHES
- GET MONITOR SWITCHES
- GET DATABASE MANAGER MONITOR SWITCHES
You must have SYSADM authority to use the UPDATE DBM CFG command.
Procedure
- To activate any of the local monitor switches, use the
UPDATE MONITOR SWITCHES command. The switches will remain active until
the application (CLP) detaches, or until they are deactivated with
another UPDATE MONITOR SWITCHES command. The following example updates
all of the local monitor switches to be ON:
db2 update monitor switches using BUFFERPOOL on LOCK on SORT on STATEMENT on TIMESTAMP on TABLE on UOW on
- To deactivate any of the local monitor switches, use the UPDATE MONITOR SWITCHES command.
The following example updates all of the local monitor switches to be OFF:
db2 update monitor switches using BUFFERPOOL off LOCK off SORT off STATEMENT off TIMESTAMP off TABLE off UOW off
The following is an example of the output you would expect to see after
issuing the previously shown UPDATE MONITOR SWITCH command:
Monitor Recording Switches
Switch list for db partition number 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
Get timestamp information (TIMESTAMP) = OFF
- It is also possible to manipulate the monitor switches
at the database manager level. This involves changing the dft_monswitches
parameters in the database manager configuration file, using the
UPDATE
DBM CFG
command. In the following example, only lock switch
controlled information is to be collected in addition to the basic
information. db2 update dbm cfg using DFT_MON_LOCK on
Whenever a monitoring application is started, it inherits its
monitor switch settings from the database manager. Any changes to
the database manager's monitor switch settings will not impact any
running monitoring applications. Monitoring applications must reattach
themselves to the instance to pick up any changes to monitor switch
settings.
- For partitioned database systems, you can set monitor switches
specifically for a certain partition, or globally for all partitions.
- To set a monitor switch (for example, BUFFERPOOL) for
a specific partition (for example, partition number 3), issue the
following command:
db2 update monitor switches using BUFFERPOOL on
at dbpartitionnum 3
- To set a monitor switch (for example, SORT) for all
partitions, issue the following command:
db2 update monitor switches using SORT on global
- To check the status of the local monitor switches use the
GET MONITOR SWITCHES command.
- For partitioned database systems, you can view the monitor
switch settings specifically for a certain partition, or globally
for all partitions.
- To view the monitor switch settings for a specific partition
(for example, partition number 2), issue the following command:
db2 get monitor switches at dbpartitionnum 2
- To view the monitor switch settings for all partitions,
issue the following command:
db2 get monitor switches global
- To check the status of the monitor switches at the database
manager level (or instance level) use the GET DATABASE MANAGER MONITOR
SWITCHES command. This command will show the overall switch settings
for the instance being monitored.
db2 get database manager monitor switches
The following is an example of the output you should expect
to see after issuing the previously shown command:
DBM System Monitor Information Collected
Switch list for db partition number 1
Buffer Pool Activity Information (BUFFERPOOL) = OFF
Lock Information (LOCK) = ON 10-25-2001 16:04:39
Sorting Information (SORT) = OFF
SQL Statement Information (STATEMENT) = OFF
Table Activity Information (TABLE) = OFF
Unit of Work Information (UOW) = OFF
Get timestamp information (TIMESTAMP) = OFF
Results
Now that you have set the required monitor switches and confirmed
the switch settings, you are ready to capture and collect monitor
data.