DB2 Version 10.1 for Linux, UNIX, and Windows

db2support - Problem analysis and environment collection tool command

Collects environment data about either a client or server machine and places the files that contain system data into a compressed file archive.

The db2support command that is shipped with DB2® installation images supports only a subset of the command parameters that are available after you install the DB2 product. Until you install the DB2 product, the only db2support command parameters that you can use are the -install and -host parameters.

This tool can also collect basic data about the nature of a problem through an interactive question and answer process with the user.

Authorization

For the most complete output, run this utility with SYSADM authority. Users with more limited privileges on the system can run this tool, however some of the data collection actions results in reduced reporting and reduced output.

Required connection

None

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-db2support--+-| Archive Mode |-----------------+------------><
               +-| Collection Mode |--------------+   
               +-| Installation collection mode |-+   
               '-| Extraction Mode |--------------'   

Archive Mode

|-- -A--archive path--+--------------+--------------------------|
                      '- -C--+-----+-'   
                             +-tar-+     
                             '-tgz-'     

Collection Mode

|--+-------------+---------------------------------------------->
   '-output path-'   

>--+------------------------------------------------------------------------------+-->
   +-| event-monitor-parameters |-------------------------------------------------+   
   '- -aem--+---------------------------------+--+------------------------------+-'   
            '- -compenv--compilation-env-file-'  '- -tbspname--table-space-name-'     

>--+-----+--+----------------------+--+-------+----------------->
   '- -B-'  '- -cd--current degree-'  '- -cfg-'   

>--+---------------------+-------------------------------------->
   '- -cl--collect level-'   

>--+-+------+--+-------+--+---------+-+--+------+--------------->
   | '- -cm-'  '- -cfs-'  '- -udapl-' |  '- -co-'   
   '-+- -ps--------+------------------'             
     '- -purescale-'                                

>--+----------------------+------------------------------------->
   '- -cs--current schema-'   

>--+----------------------------------------------------------------------------+-->
   |                                .- -c--+--------------------------------+-. |   
   |                                |      '- -u--userid--+---------------+-' | |   
   |                                |                     '- -p--password-'   | |   
   '- -d--database name--+-------+--+-----------------------------------------+-'   
                         '- -nco-'                                                  

>--+------------------+----------------------------------------->
   '- -extenddb2batch-'   

>--+--------------------------------------+--------------------->
   '- -fodc--+--------------------------+-'   
             '-list of FODC directories-'     

>--+----------------------------+--+-----+---------------------->
   '- -fodcpath--fodc_path_name-'  '- -F-'   

>--+---------------------+-------------------------------------->
   '- -fp--function path-'   

             .-all----------.                             
             | .-,--------. |                             
             | V          | |                             
   .- -host--+---hostname-+-+-------------------------.   
>--+--------------------------------------------------+--------->
   +-localhost----------------------------------------+   
   |             .-,------------------------------.   |   
   |             V                                |   |   
   '- -member--+---member_number--|--member_range-+-+-'   
               '-all--------------------------------'     

>--+-------------------------------+--+-----+------------------->
   '- -sdir--shared directory path-'  '- -h-'   

>--+---------------------+--+-----------------------+----------->
   '- -H--history period-'  '- -il--isolation level-'   

>--+-----+--+-----+--+-----+--+------+--+------+---------------->
   '- -l-'  '- -m-'  '- -n-'  '- -nc-'  '- -nl-'   

>--+---------------+--+------------------+---------------------->
   '- -o--filename-'  |       .-,------. |   
                      |       V        | |   
                      '- -ol----levels-+-'   

>--+----------------------------+------------------------------->
   '- -op--optimization profile-'   

>--+---------------------------+--+----------------+------------>
   '- -ot--optimization tables-'  '- -pf--filename-'   

>--+--------------+--+-----+--+-------------------+--+-----+---->
   '- -preupgrade-'  '- -q-'  '- -ra--refresh age-'  '- -r-'   

>--+------+--+-----+--+-------------------------+--------------->
   '- -ro-'  '- -s-'  '- -se--embedded SQL file-'   

>--+----------------+--+---------------------+------------------>
   '- -sf--SQL file-'  '- -st--SQL statement-'   

>--+--------------------+--------------------------------------->
   '- -t--time interval-'   

>--+---------------------------------------+--+-----+----------->
   '- -td--termination character delimiter-'  '- -v-'   

>--+-----+--+--------------+------------------------------------|
   '- -x-'  '- -timeout--N-'   

event-monitor-parameters

|-- -actevm--event-monitor-name-- -appid--application-id-------->

>-- -uowid--uow-id-- -actid--activity-id------------------------|

Installation collection mode

|--+-------------+---------------------------------------------->
   '-output_path-'   

>--+-----------------------------------------+------------------|
   '- -install--+--------------------------+-'   
                |         .-,--------.     |     
                |         V          |     |     
                +- -host----hostname-+-----+     
                '- -instance--instancename-'     

Extraction Mode

|--+-------------+---------------------------------------------->
   '-output_path-'   

>--+------------------------------------------+-----------------|
   '- -unzip--+-------+--compressed_file_name-'   
              +-list--+                           
              '-quiet-'                           

Note:
  1. The db2support tool collects bad query-related information only if -st, -sf, or -se parameters are specified. If there is an error or trap during optimization, use the -cl 0 (collect level zero) option to collect all catalog tables and db2look table definitions without trying to explain a bad query. The -aem (with -st or -sf) or event monitor options could be specified if activity event monitor related information needs to be collected as the part of optimizer collection. One of these options must be specified to work with optimizer problems.
    Note: Every option for the optimizer collection needs to be issued with the -d <dbname> option.
    Note: If you do not specify the -F or -full option, only the db2diag.log file from the last three days are collected for the optimizer collection. If you want to collect all files in diagpath, including the full db2diag.log for the optimizer collections, you must specify the -F or -full option.
  2. If special registers are set to values other than the default during the statement execution, pass these values to the db2support command to ensure correct problem analysis.
    Note: The special register options are ignored by db2caem collection.
  3. The -global parameter is discontinued. The -host all option is the default behavior of the db2support command and thus information from all hosts is collected by default.
  4. The db2support tool takes a long time to run since it collects most diagnostic data specific to DB2 pureScale® components by default. If you specify the -purescale, -cm, -cfs, or -udapl parameter, the db2support tool collects additional diagnostic data that is space intensive or takes a longer time to get collected, but can help speed up the problem determination process in DB2 pureScale environments.
  5. Start of changeWhen you run the db2support command globally in a multiple host environment, the absolute path of the file must be specified for options that take a file as input. The file must also be accessible by all hosts.End of change

Command parameters

output path
Specifies the path where the compressed archive file is to be created or extracted. This path is the directory where user-created files must be placed for inclusion in the archive, or the directory where files are extracted to when the -unzip parameter is specified. The current directory is used when this parameter is not specified.
-A archive_path | -archive archive_path
This parameter archives all the data from the directory specified in the diagpath configuration parameter into the specified archive path. A new directory will be created in the specified archive path with the name DB2DUMP with the system host name and timestamp appended, for example, DB2DUMP_systemhostname_2009-01-12-12.01.01.

This parameter also archives all the data from the directory specified in the alt_diagpath configuration parameter into the specified archive path. The name of this directory is ALT_DB2DUMP. Also, files from the events/ subdirectory are archived into the ALT_EVENTS directory, and files from the stmmlog/ subdirectory are archived into the ALT_STMM directory.

This parameter is not available on Windows operating systems.

-aem
Specifies that the db2caem information for the SQL statement specified through -st or -sf is to be collected. -aem does not support -se. The default behavior for db2support is to not collect db2caem information. With this parameter, db2caem creates an activity event monitor in order to collect the requested information. The activity event monitor and other created tables are cleaned up from the system.
Note: The db2support special register options are ignored by the db2caem tool; -compenv should be used to specify the compilation environment for db2caem to use. The specified SQL statement is executed by the db2caem tool.
-B | -basic
Restricts the collection to only optimizer information. No other information is collected except information for the db2supp_opt.zip file. The -basic parameter must be used with the -st, -sf, or -se parameters or a syntax error is returned.
-c | -connect
Specifies to connect to the specified database.
-cd | -curdegree
Specifies the value of the current degree special register to use. The default is the value of the dft_degree database configuration parameter.
-cfg
Collect configuration information and exclude all other support-related data. This parameter can be combined with the only following parameters: -c, -connect, -d, -database, -m, -html, -n, -number, -o, -output, -p, -password, -u, -user, -v, -verbose.
Note: This command parameter is available in DB2 Version 9.7 Fix Pack 2 and later fix packs.
-cfs
Specifies that additional diagnostic data for cluster file system is packaged into the generated .zip file. This parameter collects only additional cluster file system data that is space intensive or takes a long time to get collected.
-cl | -collect
Specifies the level of performance information to be returned. Valid values are:
0 = collect only catalogs, db2look, dbcfg, dbmcfg, db2set
1 = collect 0 plus exfmt
2 = collect 1 plus .db2service (this is the default)
3 = collect 2 plus db2batch
Note: If you specify an event monitor parameter (-actevm, -appid, -uowid, -actid) without -st, -sf, or -se, the effective collection level is 1 with only db2caem information collected (no db2exfmt collection).
-cm
Specifies that additional diagnostic data for cluster manager is packaged into the generated .zip file. This parameter collects only additional cluster manager data that is space intensive or takes a long time to get collected.
-co
Collect catalogs for all tables in the database. The default is to collect catalog information only for the tables used in a query that has a problem.
-compenv compilation-environment-file
Specifies the name of the file containing the name of the compilation environment that is used when the db2caem command is executed. The compilation environment (comp_env_desc) is in BLOB data type and is specified through a file as an input. If the parameter is not provided, the default compilation environment is used when executing db2caem.
-cs | -curschema
Specifies the current schema to use to qualify any unqualified table names in the statement. The default value is the authorization ID of the current session user.
-C | -compress
Enables archive compression. By default, the archive data is compressed into a single file. Archive compression is available only in archive mode, so you must also specify the -A parameter; otherwise, a syntax error is returned.
tar
Specifies that the files are archived using the tar (tape archive) command. The tar parameter is supported on UNIX and Linux operating systems.
tgz
Specifies that files are archived using the tar command and compressed using the gzip command. The tgz parameter is supported on UNIX and Linux operating systems.
-d database_name | -database database_name
Specifies the name of the database for which data is being collected.
Note: By default an attempt is made to connect to the specified database. To override this behavior, specify the -noconnect or -nco parameter.
-nco | -noconnect
Specifies that no attempt to connect to the specified database is to be made.
-c | -connect
Specifies that an attempt to connect to the specified database is to be made.
Note: This command parameter is included by default when a database is specified.
event-monitor-parameters
The following parameters uniquely identify the SQL statement for which the activity event monitor data is collected. They must be specified together.
-actevm activity-event-monitor-name
Specifies the name of the existing activities event monitor whose activitystmt logical grouping contains the data to be collected.
-appid application-id
Specifies the application identifier (appl_id monitor element) uniquely identifying the application that issued the activities to be collected.
-uowid uow-id
Specifies the unit of work ID (uow_id monitor element) whose data is to be collected. The unit of work ID is unique only within a given application.
-actid activity-id
Specifies the activity ID (activity_id monitor element) whose data is to be collected. The activity ID is unique only within a given unit of work.
-extenddb2batch
Specifies that db2batch information for all the optimization levels specified with the -ol or -optlevel parameter are to be captured. At least one value for the -ol parameter and a -cl parameter value of 3 must be specified with the -extenddb2batch parameter or the db2support command returns a syntax error.
-fodc
Specifies that only the FODC directories and the db2diag log files are collected. If no directories are specified, the db2support command shows a list of all the FODC directories for you to choose from. The directories are listed in ascending chronological order, based on usage timestamps, making the most recently used directories most visible.

Start of changeThe db2support command can only collect the FODC directories on the physical database host from where the command was run. The -host or -member parameters can also be used to collect FODC directories remotely. However, since the FODC directory could contain large files, like core files, it is recommended that the -fodc parameter is run on the host where FODC directories reside.End of change

Start of changeYou can specify the time interval (-t or -time) or history (-H or -history) parameters, but if a specified FODC directory is outside the specified timeframe, db2support will not collect the specified FODC directory. If the -t or -H parameters are not specified, the -fodc parameter will collect FODC directories within 14 days.End of change

You also cannot specify the archive (-A or -archive) or basic (-B or -basic) parameters when using -fodc.

Trap | Panic | BadPage | Hang | IndexError | Perf | DBMarkedBad
Specifies the category of FODC directories to collect.
list of FODC directories
Start of changeA comma-separated list of existing FODC directories. To show all FODC directories in a multiple-host environment, specify the '-host all' option.End of change
-fodcpath fodc_path_name
Specifies the full path name to an existing directory where the db2support command can search for FODC packages. The db2support command searches the following paths for collecting FODC packages:
  • The diagnostic data directory as specified by the diagpath and alt_diagpath database manager configuration parameters
  • The instance level FODCPATH settings in the DB2FODC registry variable
  • The FODCPATH settings for each member in that machine
  • The db2pdcfg setting in memory
  • The fodc_path_name specified using the db2support -fodcpath command
-F | -full
Specifies that all db2support information and optimizer-specific information are to be captured with nothing excluded.
-fp | -funcpath
Specifies the value of the function path special register to use to resolve unqualified user-defined functions and types. The default value is "SYSIBM", "SYSFUN", "SYSPROC", X, where X is the value of the USER special register, delimited by double quotation marks.
-h | -help
Displays help information. When this parameter is specified, all other parameters are ignored, and only the help information is displayed.
-H history_period | -history history_period
Limits the data that is collected to a particular interval of time. The history_period variable must be specified. The history_period variable can be specified with a number and time type with an optional beginning time value separated by a colon. The available types are:
d = days
h = hours
m = minutes
s = seconds

The beginning of time value is specified in time stamp format. Time stamp format is YYYY-MM-DD-hh.mm.ss.nnnnnn, where YYYY specifies a year, MM for a month of a year (01 through 12), DD for a day of a month (01 through 31), hh for an hour of a day (00 through 23), mm for minute of an hour (00 through 59), ss for the seconds of a minute (00 through 59), nnnnnn for microseconds on UNIX operating systems or milliseconds on Windows operating systems. You can omit some or all of the fields that follow the year field. If fields are omitted, the default values are used. The default values are 1 for the month and day, and 0 for all other fields.

The number and time type can be positive or negative, which you specify with + or - signs. If only a number and time type are specified, the default is negative. If a number and time type are specified and a beginning time value is specified, the default is positive. For example, -history 6d collects data for the past six days. -history 6d:2009 collects data for the first six days of 2009.

Start of changeThis parameter cannot be used with the -time or -t parameter. The default value is 14 days if the -H or -t parameters are not specified.End of change

-host
Specifies the host or hosts on which the command is issued. If this parameter is not specified, the command is issued on all hosts by default Start of changewith the exception of the -fodc parameterEnd of change.
all
Specifies that the command is issued on all hosts. This setting is the default behavior of the db2support command, Start of changebut does not apply to the -fodc parameter.End of change
hostname
Specifies the host or hosts on which the command is issued. If this option is not specified, the command is issued on all hosts. If multiple hosts are specified, all host names must be valid for the command to complete.

If you specify the -host option in an environment that is not a DB2 pureScale environment or a partitioned database environment, db2support returns an error.

-il | -isolation
Specifies the isolation level to use to determine how data is locked and isolated from other processes while the data is being accessed. By default, the CURRENT ISOLATION special register is set to blanks.
-install
Collects the diagnostic data that is required to troubleshoot a problem with the DB2 installation process or with the creation of an instance. The diagnostic data is stored in the db2support.zip file. Copy the db2support.exe file to your local system; this ensures that when you issue the db2support command the db2support.zip file is placed into whichever directory that you copied db2support.exe to. For the most complete collection of diagnostic data, issue the command with root authority. Also, another recommendation is to indicate an output path for the db2support.zip file by specifying the output_path variable with the -install parameter.
-host hostname |-host hostname_list
Specifies the host or hosts where diagnostic data is collected. For data collection on remote hosts, an SSH connection is required. If you do not specify a host name, diagnostic data is collected on the local host.

To collect diagnostic data on multiple hosts specify the -host parameter followed by hostname_list, where hostname_list is a comma-separated list of hosts for which you want to collect diagnostic data.

-instance instancename
Specifies the instance name for which the diagnostic data is being collected. If you do not specify this parameter, diagnostic data by default is collected on the instance defined in the DB2INSTANCE environment variable. To collect diagnostic data on a particular instance, specify the -instance parameter followed by instancename, where instancename is the name of the instance for which you want to collect diagnostic data.
-l | -logs
Specifies that active logs are to be captured.
-localhost
Specifies that the command is issued on the local host. If this option is not specified, the command is issued on all hosts.
-m | -html
Specifies that all system output is dumped into HTML formatted files. By default, all system-related information is dumped into flat text files if this parameter is not used.
-member member_number | member_range
Specifies the member or members on which the command is issued. If this parameter is not specified, the command is issued on the current member. Multiple members can be specified as a comma-separated list of member_number (member1, member2), or using member_range, where member_range is a range of members (member1-member3), or using any combination of the first two methods.
all
Specifies that the command is issued on all members defined in db2nodes.cfg.

The db2support tool runs per host. If multiple members reside on one host, db2support runs only once on the host. If you specify the members on which the command is issued, the member numbers you provide are used only to determine the hosts on which db2support runs.

If you specify the -member option in an environment that is not a DB2 pureScale environment or a partitioned database environment, db2support returns an error.

-n | -number
Specifies the problem management report (PMR) number or identifier for the current problem.
-nc | -nocatalog
Specifies that catalog information is not to be collected. By default, catalog information is collected.
-nl | -nodb2look
Specifies that db2look command information is not to be collected. By default, db2support command information is collected.
-o filename
Specifies a new name for the compressed file that is generated after issuing the db2support command. You can specify a new file name or you can state an absolute or relative path. However, the path must exist and be accessible before specifying this parameter or else an error occurs.

If this parameter is not used, the default compressed file that is generated is db2support.zip.

If this parameter is used with the output path parameter, then the path specified by output path is ignored and the path specified by the -o parameter is used.

-ol levels | -optlevel levels
Specifies the value of the optimization level special register to use. The default is the value of the dft_queryopt database configuration parameter. The optimization level value can be specified as a single value or multiple values separated by a comma.

If multiple values are specified, all optimization information is collected for the first value. For each additional optimization level value specified, the explain plans are collected and stored in a separate file along with the initial and end times of the collection for each level.

-op | -optprofile
Specifies the value of the optimization profile special register to use. This value is needed only if there was an optimization profile in effect when the statement was bound. The default is "" (an empty string).
-ot | -opttables
Specifies the value of the special register called "CURRENT MAINTAINED TABLE TYPES FOR OPTIMIZATION" that is used to identify the types of tables that can be considered when optimizing the processing of dynamic SQL queries. The initial value of CURRENT MAINTAINED TABLE TYPES FOR OPTIMIZATION is "SYSTEM".
-p password | -password password
Specifies the password for the user ID.
-ps | -purescale
Specifies that additional DB2 diagnostic data and additional diagnostic data for cluster file system, cluster manager, and uDAPL is to be collected. This parameter collects only additional diagnostic data that is space intensive or takes a longer time to get collected. Specifying this parameter is equivalent to specifying the -cm, -cfs, and -udapl parameters.
-pf filename | -profile filename
Specifies an alternative profile file. An absolute path must be specified when using this parameter to get the exact location of this new profile.

The default profile is the db2support.profile file and is stored in the sqllib/adm directory. The sqllib/adm directory is the default location of the db2support.profile file. On Windows operating systems, if the sqllib/adm directory does not exist, you must create the adm directory under sqllib before issuing the db2support command.

This profile file is used to collect additional information that is not included in the standard db2support command execution. The following are the possible templates for the profile file which can be composed of any combination and number of template 1 and template 2:

Template 1
<COLLECTION>
<NAME>...</NAME>
<CMD>...</CMD>
<OUTFILE>...</OUTFILE>
<TIMEOUT>...</TIMEOUT>
</COLLECTION>
Template 2
<COLLECTION>
<NAME>...</NAME>
<FILE>...</FILE>
<OUTFILE>...</OUTFILE>
<TIMEOUT>...</TIMEOUT>
</COLLECTION>
Each collection item is described by a name, command or file, output file, and a timeout value. This information is used to collect the additional information. Each collection item must have either a CMD or a FILE value but never both. All blank lines are skipped when this file is being parsed. The following describes the values that are encased in each collection item:
NAME
The name of the data that is being collected.
CMD
The command used at the command line to gather the additional information. This is a mandatory value.
FILE
The name of the file to collect. This is a mandatory value.
OUTFILE
The name of the output file where the collected information is stored. This is a mandatory value.
TIMEOUT
The amount of time in seconds that the command-line execution must not exceed. The default value is 180 seconds.

If the OUTFILE and CMD or FILE values are missing, a parse error occurs when db2support parses the profile file. If this occurs, db2support skips this collection. After the profile file is parsed, the collected information is stored in USERCOLLECTION/OUTFILE in the db2supp_system.zip file.

-preupgrade
Collects environment and configuration data before a critical upgrade or update such as upgrading an instance or updating to the next fix pack. This parameter helps with troubleshooting any problems that might occur after the upgrade or update. This parameter can be used with only the -d, -o, -fodcpath, -nl, -member, and -host parameters.

After the collection of data is completed, the results are compressed into a file named db2support_preupgrade.zip.

-q | -question_response
Specifies that interactive problem analysis mode is to be used.
-ra | -refreshage
Specifies the value of the refresh age special register. This value applies only if there are materialized query tables (MQTs) that reference tables in the statement. The default value of the CURRENT REFRESH AGE is zero.
Start of change-r | -redistributeEnd of change
Start of changeSpecifies that the diagnostic data related to data redistribution are to be captured.End of change
-ro | -reopt
Specifies to use EXPLAIN with the REOPT ONCE option when explaining the query. The default is to ignore the REOPT ONCE option.
-s | -system_detail
Specifies that detailed hardware and operating system information is to be gathered.
-se embedded SQL file | -sqlembed embedded SQL file
Specifies the path of the embedded SQL file containing the SQL statement for which data is being collected.
-sdir shared directory path | -S shared directory path
Specifies the shared directory that is used for temporary storage during db2support collection. If you do not specify this option, the default shared directory is used to store data temporarily. The default shared directory is <db2 instance shared directory>/sqllib_shared in DB2 pureScale environments and path/sqllib in partitioned database environments. The data that is temporarily stored is deleted when the execution of the db2support command is complete.
Note: Since sqllib_shared is used as the default shared directory in DB2 pureScale environments, ensure that there is enough space in the sqllib_shared directory to store data during the db2support collection. You can use the following formula to calculate the minimum disk space required for the sqllib_shared directory:
10GB + number of member/CF host * 2GB
-sf SQL file | -sqlfile SQL file
Specifies the file path containing the SQL statement for which data is being collected.
In DB2 pureScale and partitioned database environments, you must specify the absolute file path and ensure that the SQL file is stored in a directory that is accessible by all host. However, for optimizer collections in these multiple host environments it is recommended that you use the -localhost option to collect data on a single host. For example, to collect data on a single host you might run the following command:
 db2support -d <database_name> -sf <filepath> -localhost
Where filepath is the absolute path of the SQL file. When you use the -localhost option, as shown in the preceding example, the file name can be used in place of the absolute path if the file is stored in the current directory.
-st SQL statement | -sqlstmt SQL statement
Specifies the SQL statement for which data is being collected.
-t time_interval | -time time_interval
Limits the data that is collected by db2support to a particular time interval specified by the time_interval variable. The time interval can be specified as a start time, end time, or both in time stamp format separated by a colon. Time stamp format is YYYY-MM-DD-hh.mm.ss.nnnnnn, where YYYY specifies a year, MM for a month of a year (01 through 12), DD for a day of a month (01 through 31), hh for an hour of a day (00 through 23), mm for minute of an hour (00 through 59), ss for the seconds of a minute (00 through 59), nnnnnn for microseconds on UNIX operating systems or milliseconds on Windows operating systems. Some or all of the fields that follow the year field can be omitted. If fields are omitted, the default values are used. The default values are 1 for the month and day, and 0 for all other fields.

If only a start time is specified (-t 2009), the db2support command collects files that were modified after the start time. If only an end time is specified (-t :2009), the db2support command collects files that were modified before the end time. If both of inputs are specified (-t 2008:2009), the db2support command collects files that are modified within the interval of the start time and end time. There is no default value for this parameter. At least one of time stamps must be specified.

This parameter cannot be used with the -history or -H parameter. Start of changeThe default value is 14 days if the -H or -t parameters are not specified.End of change

-tbspname table-space-name
Specifies the table space name in which the db2caem command creates the activity event monitor. For a partitioned database environment, the table space must exist on all the database partitions where the SQL statement of interest is to be run. If the option is not provided, the default table space is used by the db2caem command when creating the activity event monitor.
-td | -delimiter
Specifies the statement termination character. This command parameter works in the same way as the -td parameter of the db2 command. The default is a semicolon.
-timeout N
Specifies the timeout period in seconds after which the db2support tool stops its execution. The N variable must be specified in seconds. timeout specifies the total run time since the start of the execution and not the timeout for each specific collection. If a timeout occurs, the db2support.zip file is created and the error messages are written to the screen and to the db2support.log file.

This parameter can be used with all other parameters.

-u userid | -user userid
Specifies the user ID to use to connect to the database.
-udapl
Specifies that diagnostic data for uDAPL is packaged into the generated .zip file. This parameter collects only additional uDAPL data that is space intensive or takes a long time to get collected.
-unzip compressed_file_name
Extracts the contents from the compressed file specified. An absolute or relative path must be specified for compressed_file_name. This parameter can extract the db2support.zip file on the system file where extraction utilities are not available. The -unzip parameter cannot be combined with parameters from other db2support modes. Also, the db2support -unzip command recognizes files specified in the compressed_file_name variable with only a .ZIP or .zip file extension.

If you specify the output_path variable with the -unzip parameter, the extracted files are placed in the output_path directory. If you do not specify the output_path variable with the -unzip parameter, by default a new directory named compressed_file_name is created under the current directory and the extracted files are placed inside the compressed_file_name directory.

list
Specifies that the contents of the compressed file are listed on standard output but not extracted. The file name, size, and date are shown. This parameter can be useful when db2support.zip is large and there is little space available on the system.
quiet
Avoids the db2support command from prompting you for input regarding extracted files already existing in the output_path or the current directory if output_path was not issued. If the quiet parameter is not issued, you are prompted with a message asking you if you want the file specified to be overwritten or not. If this parameter is specified it overwrites all the existing files without prompts.
-v | -verbose
Specifies that verbose output is to be used while this tool is running.
-x | -xml_generate
Specifies that an XML document containing the entire decision tree logic that is used during the interactive problem analysis mode (-q mode) is to be generated.

Examples

Example 1

The db2support tool is invoked in the optimizer mode in one of the following ways:

  • As an SQL statement from a command line.
    db2support output_directory -d database_name -st sql_statement

    The db2support tool stores the query in the optimizer directory by copying the query into the file called bad_query.sql.

  • As an SQL statement stored in a file.
    db2support output_directory -d database_name -sf sql_file
    The file containing the query is copied by the tool into the optimizer directory.
  • As a file containing an embedded static SQL statement with the query having the problem.
    db2support output_directory -d database_name -se embedded_sql_file
    The file containing the query is copied by the tool into the optimizer directory. The file does not need to be in the current directory but must be readable by an invoking user ID.
  • While returning different levels of performance information.
    db2support output_directory -d database_name -collect 0

    The db2support tool collects different levels of performance information based on the level of detail requested. The values 0 to 3 collect increasing amounts of detail. Catalog information and table definitions to enable you to reproduce the database objects for a production database are collected when a level of 0 is used.

Example 2
To collect information to diagnose a slow query using optimizer-related special registers that were set by default, use:
db2support . -d sample -st "SELECT * FROM EMPLOYEE"

This example returns all the data to the db2support.zip file. Diagnostic files are created in the current directory and its subdirectories (since . is specified as the output path). The system information, optimizer information, and diagnostic files are collected as well.

Example 3
To collect the same information shown in the previous example but with the user-specified values for the optimizer-related special registers, use:
db2support . -d sample -st "SELECT * FROM EMPLOYEE" -cs db2usr -cd 3
   -ol 5 -ra ANY -fp MYSCHEMA -op MYPROFSCHEMA.MYPROFILE -ot ALL -il CS
Example 4
To collect the same information shown in the previous example but with multiple user-specified values for the optimizer-related special registers and collect db2batch information for each optimizer special register value, use:
db2support . -d sample -st "SELECT * FROM EMPLOYEE" -cs db2usr -cd 3
   -ol 3,5,7 -cl 3 -extenddb2batch -ra ANY -fp MYSCHEMA -op MYPROFSCHEMA.MYPROFILE -ot ALL -il CS

This example sets the following special registers: current schema to db2usr, current degree to 3, optimization level to 5, refresh age to ANY, function path to schema MYSCHEMA, optimization profile to MYPROFSCHEMA.MYPROFILE, current maintained table types to ALL, and the isolation level to CS. These values are set only for the connection that db2support establishes to the specified database and does not affect your entire environment. Providing the same special registry variables as used when the query was run is important when correcting diagnostics.

Example 5
To limit the data collection to files modified in the last three days before the current time, use:
db2support -H 3d
Example 6
To limit the data collection to files modified in the first three days of 2009 (time period 2009–01–01–00.00.00.000000 through 2009–01–04–00.00.00.000000), use:
db2support -H 3d:2009
Example 7
To limit the data collection to files modified in time period 2008–01–01–00.00.00.000000 through the current time.
db2support -t 2008
Example 8
To limit the data collection to files modified in the time period of 2009–01–01–00.00.00.000000 through 2009–03–01–00.00.00.000000, use:
db2support -t 2009-01:2009-03
Example 9
The following section is an example profile file:
<COLLECTION>
<NAME>List</NAME>
<CMD>ls -la $HOME</CMD>
<OUTFILE>list.out</OUTFILE>
</COLLECTION>
With this profile file, db2support collects the information from the ls -la $HOME command and the results are stored in USERCOLLECTION/list.out in the db2supp_system.zip file. The timeout value is not specified because it is not mandatory. In this case, the default timeout value of 180 seconds is used.
Example 10
To extract the contents from the db2support_hostname1.zip file:
db2support -unzip db2support_hostname1.zip 
This command creates a directory named db2support_hostname1 under the current directory, and the extracted files from the db2support_hostname1.zip file is placed in the db2support_hostname1 directory.
To extract db2support.zip from the current directory and place it in the temp directory:
db2support temp -unzip db2support.zip
If some or all of the files that are being extracted exist in the destination directory, you are prompted to choose if you want to overwrite a particular file. If you want to avoid the prompts, issue the quiet parameter along with the -unzip parameter:
db2support temp -unzip quiet db2support.zip
Example 11

The following are examples of the -install and-host parameters:

To create the db2support.zip file in the current directory:
db2support -install
To specify an output path temp for the db2support.zip file:
db2support temp -install
To specify a single host on which the diagnostic data is collected:
db2support -install -host myhost1
To specify multiple hosts on which the diagnostic data is collected:
db2support -install -host myhost1,myhost2
Example 12
To specify timeout for the total db2support collection.
db2support -d sample -timeout 3
Example 13
To specify timeout for collection of hardware and operating system information.
db2support -d sample -c -s -timeout 15
Example 14
To specify timeout for the optimizer db2support collection.
db2support -d sample -c -timeout 7 -st "select * from staff"

Using db2support to collect activity event monitor data for the SQL statement:

For example:
  • db2support –d sample –st “select * from staff” –aem

    In addition to current collection at -cl 2, this command starts the db2caem command, which creates the activity event monitor and capture information of details, section, values, and actuals for the SQL statement "select * from staff". The db2support command collects all the db2caem output.

  • db2support –d sample –sf badquery.sql –aem

    In addition to current collection at -cl 2, this command invokes db2caem, which creates the activity event monitor and capture information of details, section, values, and actuals for the SQL statement specified in the file badquery.sql. The db2support command collects all the db2caem output.

  • db2support -d sample -actevm mymon –appid *LOCAL.amytang.100203234904 -uowid 44 –actid 1

    In addition to current collection at -cl 0, this command starts the db2caem command, which captures the activity event monitor information of details, section, values, and actuals for the SQL statement identified by the event monitor options from the existing activity event monitor. The db2caem command does not create an activity event monitor in this case. The db2support command collects all the db2caem output.

db2support examples for collections specific to DB2 pureScale environments

Example 1

On the host run:

host:~$ db2support
  • This command creates a db2support.zip file in the current folder. This file contains the DB2 diagnostic data and additional diagnostic data specific to DB2 pureScale components, such as cluster manager, cluster file system and uDAPL, that is collected from all hosts.
  • The db2support.zip file contains a folder called PURESCALE. The PURESCALE folder has three additional subfolders called CFS, CM, and UDAPL, with the corresponding information files inside.
  • You can specify additional parameters to this command to collect more diagnostic data.
Example 2: Running db2support with -cm option

On the host run:

host:~$ db2support -cm
  • This command creates a db2support.zip file by default and also collects additional cluster manager data that is space intensive or takes a long time to get collected. The additional cluster manager data that is collected by the -cm option is stored in the CM folder that is located inside the PURESCALE folder of the db2support.zip file.
Example 3: Running db2support with -purescale option

On the host run:

host:~$ db2support -purescale
  • This command creates a db2support.zip file by default. This command also collects additional diagnostic data that is specific to DB2 pureScale components, such as cluster manager, cluster file system and uDAPL, and takes a long time to get collected or is space intensive. The additional diagnostic data is stored in the corresponding PURESCALE, CFS, CM, and UDAPL folders located in the db2support.zip file.
  • This command collects diagnostic data that is similar to what is collected by the following command but this command also collects additional diagnostic data that is specific to DB2 pureScale environments:
    host:~$ db2support -cm -cfs -udapl

Usage notes

In order to protect the security of business data, this tool does not collect table data, schema (DDL), or logs. Some of the parameters do allow for the inclusion of some aspects of schema and data (such as archived logs). Options that expose database schema or data should be used carefully. When this tool is invoked, a message is displayed that indicates how sensitive data is dealt with.

Data collected by the db2support tool is from the machine where the tool runs. In a client-server environment, database-related information is from the machine where the database resides via an instance attachment or connection to the database. For example, operating system or hardware information (-s option) and files from the diagnostic directories (diagpath and alt_diagpath) is from the local machine where the db2support tool is running. Data such as buffer pool information, database configuration, and table space information is from the machine where the database physically resides.

There are some limitations on the type of queries accepted by the db2support optimizer tool:

The db2support command does not collect explain data for dynamic SQL.

If an FODC package is stored in a directory path that is different from the default diagnostic path or not in a path specified by an FODCPATH setting, you need to indicate the FODC path to the db2support command with the -fodcpath parameter, so that the FODC package can be included in the db2support.zip file.