Because the DEADLOCK_EVMON monitor was created with a manual start, it
remains inactive after creation. To activate an event monitor, change the state of
the event monitor to the value
1
and use the
EVENT_MON_STATE()
function to check
for the current state as shown in Example 9 25 (when calling
EVENT_MON_STATE()
use the event monitor name in upper case). After activation of
DEADLOCK_EVMON, each time a deadlock occurs in the database, it will be
recorded into the event monitor tables.
Example 9 25 Enabling event monitor
db2 set event monitor deadlock_evmon state = 1
db2 values event_mon_state( DEADLOCK_EVMON )
To browse the data collected by the event monitor, you can directly access the
tables, or use the GUI tool
db2eva
. For more information about
db2eva,
refer to
the
Command Reference
.
Event monitors offer an option to write the monitored information to a binary file.
This option is particularly useful when there is a need to prevent the event
monitor from collecting an uncontrolled amount of data.
Example 9 26 shows the creation of an event monitor that writes the diagnostic
data to files (extensions
*.EVT
) located on the c:\tmp\deadlock directory
(Windows example). If the total amount of collected data exceeds 5000 pages
(4 KB) the event monitor will stop.
Example 9 26 Creating an event monitor with the file option
db2 create event monitor deadlock_evmon for deadlocks with details
write to file c:\tmp\deadlock maxfilesize 5000 manualstart
To convert the event monitor binary files to user readable form use the
db2evmon
utility as shown in Example 9 27.
Example 9 27 Formatting event monitor output files
C:\tmp>db2evmon path c:\tmp\deadlock
Reading c:\tmp\00000000.EVT ...
EVENT LOG HEADER
Event Monitor name: DEADLOCK_EVMON
Server Product ID: SQL08014
Version of event monitor data: 7
Byte order: LITTLE ENDIAN
Number of nodes in db2 instance: 1
Codepage of database: 1252
294
MySQL to DB2 UDB Conversion Guide
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved