The dump file created by the command db2trc dmp is in binary format and is not readable.
To verify that a trace file can be read, format the binary trace file to show the flow control and send the formatted output to a null device. The following example shows the command to perform this task:
db2trc flw example.trc nul
where example.trc is a binary file that was produced using the dmp option.
The output for this command will explicitly tell you if there is a problem reading the file, and whether or not the trace was wrapped.
At this point, the dump file could be sent to DB2® Support. They would then format it based on your DB2 service level. However, you might sometimes be asked to format the dump file into ASCII format before sending it. This is accomplished via the flw and fmt options. You must provide the name of the binary dump file along with the name of the ASCII file that you want to create:
C:\>db2trc flw trace.dmp trace.flw C:\Temp>db2trc flw trace.dmp trace.flw Total number of trace records : 18854 Trace truncated : NO Trace wrapped : NO Number of trace records formatted : 1513 (pid: 2196 tid 2148 node: -1) Number of trace records formatted : 100 (pid: 1568 tid 1304 node: 0) ... C:\>db2trc fmt trace.dmp trace.fmt C:\Temp>db2trc fmt trace.dmp trace.fmt Trace truncated : NO Trace wrapped : NO Total number of trace records : 18854 Number of trace records formatted : 18854
If this output indicates "Trace wrapped" is "YES", then this means that the trace buffer was not large enough to contain all of the information collected during the trace period. A wrapped trace might be okay depending on the situation. If you are interested in the most recent information (this is the default information that is maintained, unless the -i option is specified), then what is in the trace file might be sufficient. However, if you are interested in what happened at the beginning of the trace period or if you are interested in everything that occurred, you might want to redo the operation with a larger trace buffer.
There are options available when formatting a binary file into a readable text file. For example, you can use db2trc fmt -xml trace.dmp trace.fmt to convert the binary data and output the result into an xml parsable format. Additional options are shown in the detailed description of the trace command (db2trc).
Another thing to be aware of is that on Linux® and UNIX® operating systems, DB2 will automatically dump the trace buffer to disk when it shuts the instance down due to a severe error. Thus if tracing is enabled when an instance ends abnormally, a file will be created in the diagnostic directory and its name will be db2trdmp.###, where ### is the database partition number. This does not occur on Windows® platforms. You have to dump the trace manually in those situations.
To summarize, the following is an example of the common sequence of db2trc commands:
db2trc on -l 8M db2trc clr <Execute problem recreation commands> db2trc dump db2trc.dmp db2trc off db2trc flw db2trc.dmp <filename>.flw db2trc fmt db2trc.dmp <filename>.fmt db2trc fmt -c db2trc.dmp <filename>.fmtc
Parent topic: Basic trace diagnostics
db2trc - Trace command