When you upgrade your Db2 server, it is a good
measure to run some tests on the new environment to verify that the Db2 server is working as
expected. These tests can consist of batch programs that you usually run against the Db2 server or any
programs or scripts that you run for benchmarks.
If you have Db2 command scripts with SQL statements, you can use the db2batch benchmark tool
command to execute the statements in these scripts, and gather performance information details and
statistics such as CPU time and elapsed time. This tool can work in both a single partition database
and in a multiple partition database.
Before you begin
Ensure that you have the same authority level that is required
to run the SQL statements in your script.
Procedure
To verify that your Db2 server upgrade was
successful:
-
Log on to the Db2 server as a user with
the same authority level that is required to run the SQL statements in the script.
- Prepare a script with SQL statements that you frequently
run. If you installed the sample files, you can also run any of the
sample CLP scripts.
- Run your script using the db2batch command.
The following example shows you how to run this tool with
the
testdata.db2 sample script:
cd samplefile-dir-clp
db2batch -d sample -f testdata.db2 -o r 0 p 3
where
samplefile-dir-clp is
DB2DIR/samples/clp on Linux® and UNIX and
DB2DIR\samples\clp on Windows,
DB2DIR represents
the location for your
Db2 version 11.5 copy, sample is the database name, and the option
-o
r 0 p3 indicates to print 0 fetched rows to the output
and to report elapsed time, CPU time, and summary of monitoring information
for each statement in the
testdata.db2 script.
The
following text is an extract of the summary table output generated
by the command in the previous example:
Summary Table:
Type Number Total Time Min Time Max Time Arithmetic Mean Geometric Mean
--------- ------ ---------- -------- -------- --------------- --------------
Statement 1 0.281284 0.281284 0.281284 0.281284 0.281284
Statement 2 0.073158 0.073158 0.073158 0.073158 0.073158
Statement 3 0.000823 0.000823 0.000823 0.000823 0.000823
Statement 4 0.155366 0.155366 0.155366 0.155366 0.155366
* Total Entries: 4
* Total Time: 0.510630 seconds
* Minimum Time: 0.000823 seconds
* Maximum Time: 0.281284 seconds
* Arithmetic Mean Time: 0.127658 seconds
* Geometric Mean Time: 0.040271 seconds