Other system-based DB2 tools
You have seen tools that can be used to examine the state of a database at a specific point in time (table monitoring functions and administrative views), collect data whenever a specific event or transition occurs (event monitors), and examine data access plans produced in response to queries (explain). There are other system-based tools that can be used to learn about the DB2 environment or to help locate a problem in your database environment.
db2val, or the DB2 copy validation tool, can verify the basic
functions of a DB2 copy by checking the state of installation files,
instance setup, and local database connections. The basic syntax for
db2val command is shown below. Table 9
lists available options and describes corresponding db2val behavior.
Listing 14. Basic syntax for
db2val <-o> <-i [instance_name], ... > <-a> <-s> <-b [database_name]> <-l [log_file]> <-t [trace_file]> <-h>
The instance_name specifies the instance to validate (defaults to current instance if not specified), database_name specifies the database to validate, log_file specifies the output log file for the command, and trace_file specifies the trace file path for Linux and UNIX systems.
|-o||Validate installation files only (does not validate instance, database and extended security)|
|-i||Validate the specified instance(s)|
|-a||Validate all instances in the DB2 copy|
|-s||Starts the DB2 database manager for the specified instance that is part of a partitioned database environment|
|-b||Validates database creation and connections to the database specified. Only active databases are verified|
|-l||Writes the log to the file name specified|
|-t||Specifies the full path and name of trace file (Linux and UNIX only)|
|-h||Display usage information for the |
db2ls command lists the DB2 products and features installed on
your Linux and UNIX systems, including DB2 HTML documentation. With
the ability to install multiple copies of DB2 products on your system
and the flexibility to install DB2 products and features in the path
of your choice, you can use the
db2ls command to list where DB2
products are installed on your system and the DB2 product level.
The db2mtrk utility is designed to provide a complete report of the
memory status for instances, databases, agents, and applications. When
db2mtrk command produces the following information about
memory pool allocation:
- Current size
- Maximum size (hard limit)
- Largest size (high-water mark)
- Type (identifier indicating function for which the memory pool will be used)
- Agent who allocated the pool (if the memory pool is private)
The db2mtrk utility is invoked by executing the
Listing 15. Basic syntax for the
db2mtrk <-i> <-d> <-m | -w> <-a> <-r [Interval] <[Count]> > <-v> <-h>
Interval identifies the number of seconds to wait between subsequent calls to the DB2 memory tracker, and Count identifies the number of times to repeat calling the memory tracker.
How the db2mtrk utility collects and presents information is
determined by the options specified when the
db2mtrk command is invoked. Table 10 lists options available
and describes the behavior of each.
|-i||Show instance-level memory|
|-d||Show database-level memory|
|-m||Show maximum values for each pool|
|-w||Show high-watermark values for each pool|
|-a||Show application memory usage|
|-h||Show help screen|
To obtain instance-level, database-level, and application
information, execute a
db2mtrk -a -i -d. And when this command is
executed, you might see something similar to
the output shown below.
Listing 16. Output excerpt produced by the db2mtrk utility
Tracking Memory on: 2012/08/27 at 19:57:13 Memory for instance other fcmbp monh 9.5M 768.0K 320.0K Memory for database: SAMPLE utilh pckcacheh other catcacheh bph (1) bph (S32K) 64.0K 192.0K 128.0K 192.0K 8.2M 832.0K bph (S16K) bph (S8K) bph (S4K) shsorth lockh dbh 576.0K 448.0K 384.0K 0 16.7M 14.2M apph (15) apph (14) apph (13) apph (12) apph (11) apph (10) 64.0K 64.0K 64.0K 64.0K 128.0K 64.0K apph (9) apph (8) apph (7) appshrh 64.0K 64.0K 64.0K 256.0K Application Memory for database: SAMPLE appshrh 256.0K Memory for application 13 apph other 64.0K 192.0K Memory for application 12 apph other 64.0K 192.0K Memory for application 11 apph other 128.0K 192.0K Memory for application 10 apph other 64.0K 192.0K
The db2pd utility is designed to retrieve information, in a
non-intrusive manner, from appropriate DB2 database system memory sets
and produce a thorough report that can be used to monitor or
troubleshoot a database system (or any component of a database
system). The db2pd utility is invoked by executing the
Listing 17. Basic syntax for the
db2pd <-inst> <-database [DatabaseName] ,... | -alldatabases> <-everything> <-full>
DatabaseName is the name assigned to one or more databases that information is to be obtained for.
db2pd command is executed with the
-everything option, the db2pd
utility will collect information for all elements of all databases on
all database partition servers that are local to the server. If
-full option is used, the information
produced will be expanded to its maximum length. (If this option is
not specified, the information produced is truncated to save space on
In addition to collecting a large set of information for a database
system, you can tell the db2pd utility to focus its collection on one
specific area by specifying any filters as part of the
db2pd command executed, including the following options:
For example, to obtain information about the transaction
log files associated with the SAMPLE database, you could execute a
db2pd command like this:
db2pd -database SAMPLE -logs. Then you might see something similar to
the output shown below.
Listing 18. Output excerpt produced by the db2pd utility
Database Partition 4294967295 -- Database SAMPLE -- Active -- Up 0 days 00:22:31 -- Date 08/27/2012 20:18:18 Logs: Current Log Number 0 Pages Written 8 Cur Commit Disk Log Reads 0 Cur Commit Total Log Reads 0 Method 1 Archive Status n/a Method 1 Next Log to Archive n/a Method 1 First Failure n/a Method 2 Archive Status n/a Method 2 Next Log to Archive n/a Method 2 First Failure n/a Log Chain ID 0 Current LSN 0x0000000004E28C7A Address StartLSN State Size Pages Filename 0xA2F97888 0000000004E20010 0x00000000 1000 1000 S0000000.LOG 0xA2F97048 0000000005208010 0x00000000 1000 1000 S0000001.LOG 0xA2F76598 00000000055F0010 0x00000000 1000 1000 S0000002.LOG
For more information about the db2pd command, refer to the DB2 Command Reference.