A few months ago, I got this question from a Db2 for z/OS DBA: "Is there a way we can check to see if the UNLOAD utility has been executed for certain of our tables?" The environment in question was a Db2 12 for z/OS system, and because of that I had to provide an answer that was less-than-great from an ease-of-use persepective: "Yes, you can do that in a Db2 12 environment, but the process is going to be a bit cumbersome. You could set up a Db2 audit policy that would record utility execution. What that will do is cause Db2 to write certain trace records when utilities are executed. You'd need to use your Db2 monitor to format that trace information into a human-readable report (using IBM's OMEGAMON monitor for Db2 for z/OS, that would be by way of a Record Trace report); and, you'd have trace records written for EVERY utility execution during the reporting time interval - potentially, a lot of data to sift through; and, there would be trace records generated for every utility executed for ANY database object - not just the tables in which you're interested (more data to sift through)."
"Alternatively, you could set up a different audit policy that would limit trace output to the tables of interest, but that policy would cause Db2 to generate trace records for ALL operations performed involving that set of tables, whether associated with a utility or with an application process - again, potentially a lot of trace data to sift through."
Not the idea situation, but along comes Db2 13 for z/OS to make things better - in two steps.
Step 1: Once you've activated function level V13R1M501, you can take advantage of a new ZPARM parameter, UTILITY_HISTORY. The default value for that parameter is NONE - not because we (IBM) want to discourage you from using a new Db2 capability; rather, this is in keeping with the traditional approach for a new ZPARM: the initial default value preserves existing behavior. "Existing behavior" in this case is "no utility history," because utility history functionality was not available prior to Db2 13 function level 501. If you set UTILITY_HISTORY to UTILITY, something nice happens: every time a utility executes, Db2 will insert a row into the SYSIBM.SYSUTILITIES table (newly added when CATMAINT is executed to take the catalog to the V13R1M501 level). That row for a utility in SYSUTILITIES provides a lot of useful information, such as:
- The name of the utility (e.g., UNLOAD, or COPY, or REORG, or ...)
- The name of the job through which the utility was executed
- The user ID that invoked the utility
- The starting point of the utility, both timestamp-wise and logpoint-wise
- The timestamp at which the utility completed processing
- The elapsed time for the utility job
- The general-purpose CPU time and zIIP CPU time for the utility job
- The portion of CPU time (both general-purpose and zIIP) consumed with sort activity related to the utility job
- The utility job's return code
- Whether the utility job was terminated (and, if so, whether it was restarted)
- All the utilities that executed between midnight and 8:00 AM this morning
- All the utilities that are currently active or stopped
- All the utilities that finished with a return code of 8 or higher
- The top general-purpose CPU-consuming LOAD jobs over the past 7 days
- And more...