Tracing Problems in DB2 These traces can be used for problem determination:
In this section we look at DB2 traces. For information about other trace capabilities, refer to the appropriate product documentation. DB2 TracesDB2 trace allows you to trace and record subsystem data and events. There are five different types of trace, and DB2 trace can record six types of data: statistics, accounting, audit, performance, monitor, and global. The tables later in this chapter indicate which instrumentation facility IDs (IFCIDs) are activated for the different types of trace, the classes within those trace types, and the information each IFCID returns. The trace records are written using generalized trace facility (GTF) or system management facility (SMF) records. We now take a look at the types of data DB2 collects for each trace class. StatisticsThe data collected in the statistics trace allows you to conduct DB2 capacity planning and to tune the entire set of DB2 programs. The statistics trace reports information about how much the DB2 system services and database services are used. It is a systemwide trace and should not be used for charge-back accounting. Use the information the statistics trace provides to plan DB2 capacity or to tune the entire set of active DB2 programs. Statistics trace classes 1, 3, 4, and 5 are the default classes for the statistics trace if statistics is specified YES in panel DSNTIPN. If the statistics trace is started using the START TRACE command, then class 1 is the default class.
If you specified YES in the SMF STATISTICS field on the Tracing Panel (DSNTIPN), the statistics trace starts automatically when you start DB2, sending class 1, 3, 4, and 5 statistics data to SMF. SMF records statistics data in both SMF type 100 and 102 records. IFCIDs 0001, 0002, 0202, and 0230 are of SMF type 100. All other IFCIDs in statistics trace classes are of SMF type 102. From panel DSNTIPN, you can also control the statistics collection interval (STATISTICS TIME field). The statistics trace is written on an interval basis, and you can control the exact time that statistics traces are taken. AccountingThe accounting trace provides data that allows you to assign DB2 costs to individual authorization IDs and to tune individual programs. The DB2 accounting trace provides information related to application programs, including such things as
Accounting times are usually the prime indicator of a performance problems, and most often should be the starting point for analysis. DB2 times are classified as follows :
DB2 trace begins collecting this data at successful thread allocations to DB2 and writes a completed record when the thread terminates or when the authorization ID changes. Accounting data for class 1 (the default) is accumulated by several DB2 components during normal execution. This data is then collected at the end of the accounting period; it does not involve as much overhead as individual event tracing. On the other hand, when you start class 2, 3, 7, or 8, many additional trace points are activated. Every occurrence of these events is traced internally by DB2 trace, but these traces are not written to any external destination. Rather, the accounting facility uses these traces to compute the additional total statistics that appear in the accounting record, IFCID 003, when class 2 or class 3 is activated. Accounting class 1 must be active to externalize the information. To turn on accounting for packages and DBRMs, accounting trace classes 1 and 7 must be active. Though you can turn on class 7 while a plan is being executed, accounting trace information is only gathered for packages or DBRMs executed after class 7 is activated. Activate accounting trace class 8 with class 1 to collect information about the amount of time an agent was suspended in DB2 for each executed package. If accounting trace classes 2 and 3 are activated, there is minimal additional performance cost for activating accounting trace classes 7 and 8. If you want information from either or both accounting class 2 and 3, be sure to activate classes 2 and/or 3 before your application starts. If these classes are activated during the application, the times gathered by DB2 trace are only from the time the class was activated. Accounting trace class 5 provides information on the amount of elapsed time and task control block (TCB) time that an agent spent in DB2 processing instrumentation facility interface (IFI) requests. If an agent did not issue any IFI requests, these fields are not included in the accounting record. If you specified yes for SMF ACCOUNTING on the Tracing Panel, the accounting trace starts automatically when you start DB2 and sends IFCIDs that are of SMF type 100 to SMF. The accounting record IFCID 0003 is of SMF type 101. PerformanceThe performance trace provides information about a variety of DB2 events, including events related to distributed data processing. You can use this information to further identify a suspected problem or to tune DB2 programs and resources for individual users or for DB2 as a whole. To trace performance data, you must use the START TRACE(PERFM) command. Performance traces cannot be automatically started. AuditThis trace provides data that can be used to monitor DB2 security and access to data to ensure that data access is allowed only for authorized purposes. On the CREATE TABLE or ALTER TABLE statements, you can specify whether or not a table is to be audited and in what manner; you can also audit security information, such as any access denials, grants, or revokes for the table. The default causes no auditing to take place. If you specified yes for AUDIT TRACE on the Tracing Panel, audit trace class 1 starts automatically when you start DB2. By default, DB2 sends audit data to SMF. MonitorThe monitor trace records data for online monitoring with user -written programs. This trace type has several predefined classes; those that are used explicitly for monitoring are listed here:
Invoking TracesTraces can be started automatically via the DB2 install panels, or they can be stopped and started dynamically by using the TRACE commands. The trace commands include
Trace ClassesIt is important to have the appropriate classes always gathering information about your DB2 subsystem and its activity. It is a general recommendation that you have SMF accounting class 1, 2, and 3, and SMF statistics class 1, 3, and 4 (1 and 3 at a minimum) selected during normal execution. Any other trace classes should not be run constantly because they cause excessive overhead if run for long periods of time. When executing other traces, it is wise to time the trace to only the IFCIDs necessary for the appropriate performance analysis or problem diagnosis. These traces also should only be run for short periods of time. Following is an example of limiting a trace. -START TRACE(PERFTC1) CLASS(8) IFCID(0221) PLANNAME(CERTPLA) In the above example, this limits a performance trace to class 8 with IFCID 221, which is used to view the actual degree of parallelism at runtime. IFCIDsTables 17-5 through 17-9 show the various IFCIDs that are started for each different type of class within a trace. Table 17-5. Accounting Trace
Table 17-6. Audit Trace
Table 17-7. Monitor Trace
Table 17-8. Performance Trace
Table 17-9. Statistics Trace
|
Team-Fly |
Top |