Altering an event monitor
You cannot change an event monitor, with one exception: you can add one or more logical data groups to the set of logical data groups that the event monitor collects. You use the ALTER EVENT MONITOR statement to add logical groups.
About this task
The preceding DDL statement creates an event monitor that writes to two tables: ACTIVITY_myacts and ACTIVITY_METRICS_myacts.
CREATE EVENT MONITOR myacts FOR ACTIVITIES WRITE TO TABLE event_activity, event_activity_metrics
can use the ALTER EVENT MONITOR statement only to add logical data
groups to an event monitor. You cannot remove a logical data group.
You also cannot change the name, the target table space, or the value
for PCTDEACTIVATE that is associated with the table that is used to
capture the data in monitor elements that belong to a data group.
To add additional logical data groups to an event monitor:
- Decide which logical data group you want to add.
Using the preceding example of a locking event monitor where only two logical data groups are being captured, assume that you want to add the event_activitystmt and event_activityvals logical data groups.
- Formulate an ALTER EVENT MONITOR statement to add these
new logical data groups.
ALTER EVENT MONITOR mylacts ADD LOGICAL GROUP event_activitystmt ADD LOGICAL GROUP event_activityvals
- Execute the statement.
ExampleA database administrator creates a locking event monitor called
mylocksby using the following SQL statement:
This statement collects information for monitor elements in the lock and lock_participants logical data groups. The tables to which the monitor element data is written are created with the default table names LOCK_MYLOCKS and LOCK_PARTICIPANTS_MYLOCKS.
CREATE EVENT MONITOR mylocks FOR LOCKING WRITE TO TABLE LOCK, LOCK_PARTICIPANTS
This statement causes the monitor elements in the lock_participant_activities to be collected in addition to the other elements that already were collected. This new set of monitor elements are written to the table LOCK_PARTICIPANT_ACTIVITIES_MYLOCKS.
ALTER EVENT MONITOR mylocks ADD LOGICAL GROUP LOCK_PARTICIPANT_ACTIVITIES
This statement adds the control logical data group to the output of the event monitor. This statement adds the control logical data group to the output of the event monitor. The data is written to the CTL_MYLOCKS table, and the table is written to the table space mytbsp3, instead of the default table space.
ALTER EVENT MONITOR mylocks ADD LOGICAL GROUP CONTROL TABLE ctl_mylocks IN mytbsp3