list of useful db2pd commands
DB2PD is a diagnostic tool avaialble in DB2 forLUW.It is used for monitoring and troubleshooting. It gets the information from DB2 memory.
To quote from IBM manual,
"
The tool collects information without acquiring any latches or using any engine
resources. It is therefore possible (and expected) to retrieve information that is
changing while db2pd is collecting information; hence the data might not be
completely accurate. If changing memory pointers are encountered, a signal
handler is used to prevent db2pd from ending abnormally. This can result in
messages such as "Changing data structure forced command termination" to
appear in the output. Nonetheless, the tool can be helpful for troubleshooting. Two
benefits to collecting information without latching include faster retrieval and no
competition for engine resources.
"
db2pd –osinfo => To display the operating system information
db2pd -inst => To display all instance-related information
db2pd -db dbname => To display all database-related information to the database dbname
db2pd -db databasename -locks -transactions -applications -dynamic =>Diagnosing a lockwait
db2pd -wlocks -db dbname => capture all the locks being waited on
db2pd -apinfo AppHandl -db dbname => capture detailed runtime information about the lock owner and the lock waiter
db2pd -db sample -locks => Using the callout scripts when considering a locking problem
db2pd -applications -dynamic =>reports the current and last anchor ID and statement unique ID for dynamic SQL statements. This allows direct mapping from an application to a dynamic SQL statement.
db2pd -tcbstats => you can identify the number of inserts for a table.
db2pd -tablespaces => gives number of inserts at tablespace level
db2pd -db sample -dyn => you can identify the dynamic SQL statement that is using the table
db2pd -recovery -db sample (or alldbs)=> the output shows several counters that you can use to verify that recovery is progressing
db2pd -transactions -db dbname => the output shows the number of locks, the first log sequence number (LSN), the last LSN, the first LSO, the last LSO, the log space used, and the space reserved
db2pd -logs -db dbname => for monitoring log usage for a database. By using thePages Written value, as shown in the following sample output, you can determine whether the log usage is increasing
You can identify two types of problems by using this output:
a)If the most recent log archive fails, Archive Status is set to a value of Failure. If there is an ongoing archive failure, preventing logs from being archived at all,
Archive Status is set to a value of First Failure.
b)If log archiving is proceeding very slowly, the Next Log to Archive value is lower than the Current Log Number value. If archiving is very slow, space for
active logs might run out, which in turn might prevent any data changes from occurring in the database.
db2pd -sysplex => Viewing the sysplex list
db2pd -stack all => to produce stack traces for all processes in the current database partition. You might want to use this command iteratively when you suspect that a process or thread is looping or hanging.
db2pd -stack eduid => obtain the current call stack for a particular engine dispatchable unit (EDU)
db2pd -dbptnmem => shows how much memory the DB2 server is currently consuming and, at a high level, which areas of the server are using that memory.
db2pd -reorgs index -db dbname => reports index reorg progress for partitioned indexes (Fix Pack 1 introduced support for only non-partitioned indexes).
db2pd -edus interval=5 => the deltas for processor user time and processor system time are given across a five-second interval
db2pd -edus interval=5 top=5 stacks
db2pd -agents event => If you need to determine whether an agent changed state during a specific period of time, use the event option together with the -agents parameter. The
AGENT_STATE_LAST_UPDATE_TIME(Tick Value) column that is returned shows the last time that the event being processed by the agent was changed
db2pd -tablespaces -db sample => list tablespaces details
db2pd -db dbname -tcbstats tmp_space_id to monitor temp space
db2pdcfg -catch => to capture information about the database management system when a specific SQLCODE, ZRC code or ECF code occurs
When the errors are caught, the db2cos (callout script) is launched. The db2cos script can be dynamically altered to run any db2pd
command, operating system command, or any other command needed to resolve the problems. The template db2cos script file is located in sqllib/bin on UNIX
and Linux. On the Windows operating system, db2cos is located in the $DB2PATH\bin directory.
db2pd -addnode => When adding a new node, you can monitor the progress of the operation on the database partition server, that is adding the node.Use optional oldviewapps and detail parameters for more detailed information.
db2pd -gfw => If you require a list of event monitors that are currently active or have been, for some reason, deactivated, run the db2pd -gfw command. This command also
returns statistics and information about the targets, into which event monitors write data, for each fast writer EDU.
To quote from IBM manual,
"
The tool collects information without acquiring any latches or using any engine
resources. It is therefore possible (and expected) to retrieve information that is
changing while db2pd is collecting information; hence the data might not be
completely accurate. If changing memory pointers are encountered, a signal
handler is used to prevent db2pd from ending abnormally. This can result in
messages such as "Changing data structure forced command termination" to
appear in the output. Nonetheless, the tool can be helpful for troubleshooting. Two
benefits to collecting information without latching include faster retrieval and no
competition for engine resources.
"
db2pd –osinfo => To display the operating system information
db2pd -inst => To display all instance-related information
db2pd -db dbname => To display all database-related information to the database dbname
db2pd -db databasename -locks -transactions -applications -dynamic =>Diagnosing a lockwait
db2pd -wlocks -db dbname => capture all the locks being waited on
db2pd -apinfo AppHandl -db dbname => capture detailed runtime information about the lock owner and the lock waiter
db2pd -db sample -locks => Using the callout scripts when considering a locking problem
db2pd -applications -dynamic =>reports the current and last anchor ID and statement unique ID for dynamic SQL statements. This allows direct mapping from an application to a dynamic SQL statement.
db2pd -tcbstats => you can identify the number of inserts for a table.
db2pd -tablespaces => gives number of inserts at tablespace level
db2pd -db sample -dyn => you can identify the dynamic SQL statement that is using the table
db2pd -recovery -db sample (or alldbs)=> the output shows several counters that you can use to verify that recovery is progressing
db2pd -transactions -db dbname => the output shows the number of locks, the first log sequence number (LSN), the last LSN, the first LSO, the last LSO, the log space used, and the space reserved
db2pd -logs -db dbname => for monitoring log usage for a database. By using thePages Written value, as shown in the following sample output, you can determine whether the log usage is increasing
You can identify two types of problems by using this output:
a)If the most recent log archive fails, Archive Status is set to a value of Failure. If there is an ongoing archive failure, preventing logs from being archived at all,
Archive Status is set to a value of First Failure.
b)If log archiving is proceeding very slowly, the Next Log to Archive value is lower than the Current Log Number value. If archiving is very slow, space for
active logs might run out, which in turn might prevent any data changes from occurring in the database.
db2pd -sysplex => Viewing the sysplex list
db2pd -stack all => to produce stack traces for all processes in the current database partition. You might want to use this command iteratively when you suspect that a process or thread is looping or hanging.
db2pd -stack eduid => obtain the current call stack for a particular engine dispatchable unit (EDU)
db2pd -dbptnmem => shows how much memory the DB2 server is currently consuming and, at a high level, which areas of the server are using that memory.
db2pd -reorgs index -db dbname => reports index reorg progress for partitioned indexes (Fix Pack 1 introduced support for only non-partitioned indexes).
db2pd -edus interval=5 => the deltas for processor user time and processor system time are given across a five-second interval
db2pd -edus interval=5 top=5 stacks
db2pd -agents event => If you need to determine whether an agent changed state during a specific period of time, use the event option together with the -agents parameter. The
AGENT_STATE_LAST_UPDATE_TIME(Tick Value) column that is returned shows the last time that the event being processed by the agent was changed
db2pd -tablespaces -db sample => list tablespaces details
db2pd -db dbname -tcbstats tmp_space_id to monitor temp space
db2pdcfg -catch => to capture information about the database management system when a specific SQLCODE, ZRC code or ECF code occurs
When the errors are caught, the db2cos (callout script) is launched. The db2cos script can be dynamically altered to run any db2pd
command, operating system command, or any other command needed to resolve the problems. The template db2cos script file is located in sqllib/bin on UNIX
and Linux. On the Windows operating system, db2cos is located in the $DB2PATH\bin directory.
db2pd -addnode => When adding a new node, you can monitor the progress of the operation on the database partition server, that is adding the node.Use optional oldviewapps and detail parameters for more detailed information.
db2pd -gfw => If you require a list of event monitors that are currently active or have been, for some reason, deactivated, run the db2pd -gfw command. This command also
returns statistics and information about the targets, into which event monitors write data, for each fast writer EDU.
1 Comments:
Hi There
Thank you for sharing very detailed db2pd Commands
Post a Comment
Subscribe to Post Comments [Atom]
<< Home