Monitoring backup and restore performance with db2pd -barstats

Starting in Db2® Version 11.1.4.4, the db2pd command can be used with the -barstats parameter to retrieve monitoring information about the performance of backup and restore operations.

About this task

This task is broken into two general steps:
  • Finding the Agent Engine Dispatchable Unit (EDU) ID of a running backup or restore operation.
  • Running the db2pd command with the -barstats option to retrieve the performance monitoring information.

Procedure

  1. From the command line tool, run the db2pd command with the -apinfo option to find the AppHandl value with an application status of either PerformingBackup or RestoringDatabase.
    For example, the following code shows an AppHandl value of 83:
    $ db2pd -db sample -alldbpartitionnums -apinfo | grep -B20 "PerformingBackup" | grep "AppHandl"
    
    AppHandl [nod-index] :   83       [000-00083]
    
    
    On system without GNU grep, awk alternative can be used as the following:
    $ db2pd -db sample -alldbpartitionnums -apinfo | awk '/PerformingBackup/{for(i=1;i<=x;)print a[i++];print} {for(i=1;i<x;i++)a[i]=a[i+1];a[x]=$0;}' x=20 | grep AppHandl
      AppHandl [nod-index] :   116      [000-00116]
    Note that specific syntax might be difference across different OS or system and grep/awk versions.
  2. Run the db2pd command again, this time with the -agents option, to identify the Agent EDU ID value for the backup or restore operation.
    In the following example, the AppHandl value of 83 is used to identify the Agent EDU ID value of 669.

    In Db2 Enterprise Server Edition or Db2 pureScale® environments, run the following:

    $db2pd -agents db=sample app=83 | grep Coord | awk '{print $4}'
    669
    In Data Partitioning Feature (DPF) environments, run the following:
    $db2pd -dbpartitionnum <dbpartitionnum> -agents db=sample app=83 | grep SubAgent | awk '{print $4}'
    669
  3. Run the db2pd command again, this time with the -barstats option, along with the Agent EDU ID value that you retrieved, to display the wanted performance monitoring information.
    In the following examples, the Agent EDU ID value of 669 is used to identify the backup or restore operation.
    In Db2 Enterprise Server Edition or Db2 pureScale environments, run the following:
    $ db2pd -db sample -barstats 669
    In Data Partitioning Feature (DPF) environments, run the following:
    db2pd -dbpartitionnum <dbpartitionnum> -db sample -barstats 669
    Note: In DPF environments, use the -dbpartitionnum N option to specify the database partition.

Results

While the result sets differ depending on the type of operation (backup or restore), they display similar information:
  • The EDU or thread identifiers
  • Table spaces impacted by the operation
  • Performance statistics

See Example output for backup performance monitoring and Example output for restore performance monitoring for a detailed breakdown of the fields and values that are displayed in the monitoring information for each operation.