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
CREATE EVENT MONITOR myacts FOR ACTIVITIES
WRITE TO TABLE
event_activity, event_activity_metrics
The preceding
DDL statement creates an event monitor that writes to two tables:
ACTIVITY_myacts and ACTIVITY_METRICS_myacts. Restrictions
You 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.Procedure
To add additional logical data groups to an event monitor:
Results
- ACTIVITYSTMT_myacts
- ACTIVITYVALS_myacts
Remember: If you add new logical data groups to an event monitor,
any data that existed for the logical data groups that were originally
part of the table will not have any corresponding rows in the tables
for the newly added logical group. Adjust your queries as needed,
or consider pruning old data from the table after adding the logical
groups.
Example
A database administrator creates a locking event monitor calledmylocks
by
using the following SQL statement: CREATE EVENT MONITOR mylocks FOR LOCKING WRITE TO TABLE LOCK, LOCK_PARTICIPANTS
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.Later on, the database administrator
decides that she wants to collect information in the LOCK_PARTICIPANT_ACTIVITIES
logical data group. She uses the following statement to modify the
event monitor:
ALTER EVENT MONITOR mylocks ADD LOGICAL GROUP LOCK_PARTICIPANT_ACTIVITIES
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.Later, the database administrator
decides that she also needs the data from the control logical data
group. However, she wants this data to be written to a table with
a name other than the default name, and to a table space other than
the default table space. She uses the following statement:
ALTER EVENT MONITOR mylocks ADD LOGICAL GROUP CONTROL TABLE ctl_mylocks IN mytbsp3
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.