The Start Database Monitor (STRDBMON) command starts the collection of database performance statistics for a specified job, for all jobs on the system or for a selected set of jobs. The statistics are placed in a user-specified database table and member. If the table or member do not exist, one is created based on the QAQQDBMN table in library QSYS. If the table and member do exist, the record format of the specified table is verified to insure it is the same.
For each monitor started using the STRDBMON command, the system generates a monitor ID that can be used to uniquely identify each individual monitor. The monitor ID can be used on the ENDDBMON command to uniquely identify which monitor is to be ended. The monitor ID is returned in the informational message CPI436A which is generated for each occurrence of the STRDBMON command. The monitor ID can also be found in column QQC101 of the QQQ3018 database monitor record.
Informally there are two types of monitors. A private monitor is a monitor over one, specific job (or the current job). Only one (1) monitor can be started on a specific job at a time. For example, STRDBMON JOB(*) followed by another STRDBMON JOB(*) within the same job is not allowed. A public monitor is a monitor which collects data across multiple jobs. There can be a maximum of ten (10) public monitors active at any one time. For example, STRDBMON JOB(*ALL) followed by another STRDBMON JOB(*ALL) is allowed providing the maximum number of public monitors does not exceed 10. You may have 10 public monitors and 1 private monitor active at the same time for any specific job.
If multiple monitors specify the same output file, only one copy of the database statistic records will be written to the specified output file for each job. For example, STRDBMON OUTFILE(LIB/TABLE1) JOB(*) and STRDBMON OUTFILE(LIB/TABLE1) JOB(*ALL) target the same output file. For the current job, you will not get two copies of the database statistic records, one copy for the private monitor and one copy for the public monitor. You will get only one copy of the database statistic records.
If the monitor is started on all jobs (a public monitor), any jobs waiting on job queues or any jobs started during the monitoring period are included in the monitor data. If the monitor is started on a specific job (a private monitor) that job must be active in the server when the command is issued. Each job in the server can be monitored concurrently by one private monitor and a maximum of 10 public monitors.
The STRDBMON command allows you to collect statistic records for a specific set or subset of the queries running on any job. This filtering can be performed over the job name, the user profile, the name of the table(s) being queried, the estimated run time of the query, the TCP/IP internet address, or any combination of those filters. Specifying a STRDBMON filter should help minimize the number of statistic records captured for any monitor.
STRDBMON OUTFILE(QGPL/FILE1) OUTMBR(MEMBER1 *ADD) JOB(*ALL) FRCRCD(10)
This command starts database monitoring for all jobs on the system. The performance statistics are added to the member named MEMBER1 in the file named FILE1 in the QGPL library. Ten records will be held before being written to the file.
STRDBMON OUTFILE(*LIBL/FILE3) OUTMBR(MEMBER2) JOB(134543/QPGMR/DSP01) FRCRCD(20)
This command starts database monitoring for job number 134543. The job name is DSP01 and was started by the user named QPGMR. The performance statistics are added to the member named MEMBER2 in the file named FILE3. Twenty records will be held before being written to the file.
STRDBMON OUTFILE(LIB41/DBMONFILE) JOB(134543/QPGMR/DSP01)
This command starts database monitoring for job number 134543. The job name is DSP01 and was started by the user named QPGMR. The performance statistics are added to the member name DBMONFILE (since OUTMBR was not specified) in the file named DBMONFILE in the library named LIB41. This library may exist in more than one independent auxiliary storage pool (ASP); the library in the name space of the originator's job will always be used.
STRDBMON OUTFILE(LIB41/DBMONFILE) JOB(*ALL/*ALL/QZDA*)
This command starts database monitoring for all jobs whose job name begins with 'QZDA'. The performance statistics (monitor records) are added to member DBMONFILE (since OUTMBR was not specified) in file DBMONFILE in library LIB41. This library may exist in more than one independent auxiliary storage pool (ASP); the library in the name space of the originator's job will always be used. Note that because this is a public type monitor, so any QZDA jobs that are started will also have statistics records collected.
STRDBMON OUTFILE(LIB41/DBMONFILE) JOB(*ALL) RUNTHLD(10)
This command starts database monitoring for all jobs. Monitor records are created only for those SQL statements whose estimated run time meets or exceeds 10 seconds.
STRDBMON OUTFILE(LIB41/DBMONFILE) JOB(*) FTRFILE(LIB41/TABLE1)
This command starts database monitoring for the current job. Monitor records are created only for those SQL statements that use file TABLE1 in Library LIB41.
STRDBMON OUTFILE(LIB41/DBMONFILE) JOB(*) FTRUSER(*CURRENT)
This command starts database monitoring for the current job. Monitor records are created only for those SQL statements that are executed by the current user.
STRDBMON OUTFILE(LIB41/DBMONFILE) JOB(*ALL/*ALL/QZDA*) RUNTHLD(10) FTRUSER(DEVLPR1) FTRFILE(LIB41/TTT*)
This command starts database monitoring for all jobs whose job name begins with 'QZDA'. Monitor records are created only for those SQL statements that meet all of the following conditions: