DB2 for z/OS does not keep a diary unless you ask. A trace tells the Instrumentation Facility which IFCIDs to record and where to send them: SMF, GTF, or an OP buffer. This page covers START TRACE, STOP TRACE, MODIFY TRACE, trace types and classes, destinations, overhead, and how to read what you collected.
Hierarchy:
Starting a class starts every IFCID in that class. Starting the same IFCID in two classes does not write it twice. Classes 30, 31, and 32 are reserved empty so you can code IFCID(n,m,...) without dragging a whole performance class along.
| Type | Typical default DEST | Role |
|---|---|---|
| STAT | SMF | Subsystem interval counters |
| ACCTG | SMF | Per-thread IFCID 3 / 239 |
| AUDIT | SMF | Security events; policies optional |
| PERFM | GTF | Diagnostic IFCIDs; filter hard |
| MONITOR | OPX | Near real-time for monitors |
| GLOBAL | GTF | IBM service; high overhead |
12345-START TRACE(ACCTG) CLASS(1,2,3) DEST(SMF) -START TRACE(STAT) CLASS(1) DEST(SMF) -START TRACE(PERFM) CLASS(30) IFCID(22,63) DEST(GTF) PLAN(PAY01) -START TRACE(AUDIT) DEST(SMF) -START TRACE(MONITOR) CLASS(1,2,3) DEST(OPX)
Useful keywords:
DSNZPARM SMFSTAT and SMFACCT auto-start statistics and accounting classes at Db2 start so you do not rely on a forgotten START TRACE after IPL. User-started traces (including monitor products that START TRACE into OPX) need the same discipline as a change window.
DISPLAY TRACE(*) first. Note the TNO.
1234-DISPLAY TRACE(*) -STOP TRACE(TNO(04)) -STOP TRACE(PERFM) DEST(GTF) -MODIFY TRACE(PERFM) TNO(05) CLASS(30) IFCID(22,63,95)
STOP TRACE can qualify by type, class, dest, or TNO. If you omit DEST, destination is not used as a filter — you might stop more than the GTF experiment.MODIFY TRACE changes IFCIDs/classes on an active trace so monitors do not have to detach. You cannot invent a new destination with MODIFY; stop and start if you need GTF instead of SMF.
| DEST | When to use it |
|---|---|
| SMF | Standing STAT/ACCTG/AUDIT; types 100/101/102 |
| GTF | High-volume PERFM; needs GTF started with USR |
| OPX / OPn | Online monitors via IFI; buffers, not SMF files |
| SRV | IBM service routine |
SMF mapping: statistics IFCIDs 1, 2, 202, 225, 230 → type 100; accounting 3 and 239 → type 101; remaining IFCIDs → type 102. GTF must be active with the USR option that accepts Db2’s record id. OPX assigns the next free OP buffer; a monitor issues READA/READS against it. If the monitor dies and the buffer fills, traces can wrap or stall — DISPLAY TRACE still shows them as active.
Cost is not one number. Rough field practice:
Reduce cost: filter PLAN/AUTHID/LOCATION, use class 30 + IFCID list, prefer GTF for a 10-minute burst, STOP when you have data, never stack duplicate START TRACE of the same classes. COMMENT every start so DISPLAY TRACE is readable at 3 a.m.
Raw SMF is not a report. You need:
Interpretation order: confirm the trace was on for the incident window (DISPLAY TRACE history is gone — rely on COMMENT and the SMF interval). Check you are looking at the right CONNID/CORRID. Then class 1 vs 2 vs 3, then getpages, then EXPLAIN. A performance trace of IFCID 22 (mini-plan) without accounting context is a pile of parts without the box.
Record layout is writer header (SMF vs GTF vs OP) + self-defining section + product section + data sections. You almost never parse that by hand unless you write an IFI program.
Tracing is putting cameras in the Db2 kitchen. Statistics cameras take one wide photo every minute of the whole kitchen (SMF 100). Accounting cameras follow each waiter with a stopwatch (SMF 101). Performance cameras film every stir of every pot — you only turn those on when the soup tastes wrong, and you point them at one recipe (PLAN) so you do not fill the memory card (GTF/SMF). START TRACE is turning a camera on, STOP is off, MODIFY is changing the lens while it rolls. DISPLAY TRACE is walking the hallway to see which cameras are still blinking. Global cameras are for the factory inspectors, not for dinner service.
1. Default destination for accounting and statistics traces is usually:
2. CLASS(30) IFCID(316,318) is used to:
3. MODIFY TRACE is for:
4. Global trace is intended for:
5. The biggest overhead risk is typically: