DB2 Version 9.7 for Linux, UNIX, and Windows

How to read command syntax help

From time to time, you might forget the options that are valid for a command. You can invoke useful command help screen output which uses a syntax convention which is explained here.

All Command Line Processor (CLP) commands can invoke a help screen at the CLP prompt by preceding the command keyword(s) with a question mark (?). For many of the system commands, a summarizing help screen can be displayed by issuing the command keyword followed by a help parameter.

Invoking help

CLP commands
To display a CLP command help screen, preface the command keyword(s) with a question mark at the db2 interactive mode prompt (db2 =>), as shown in the example below for the BACKUP DATABASE command:
db2 => ? backup database
or, outside the 'db2' interactive mode, preface each command help screen invocation with db2, as shown below for the BACKUP DATABASE command:
=> db2 ? backup database
System commands
Most of the system commands can display a command help screen by entering the system command keyword followed by a help option. Many system commands use a common help option, while other system commands may use different and/or additional help options. For the first attempts, without having to search for a command's forgotten help option just yet, try the following most common options which are likely to result in successfully invoking the command help screen:
Help options
  • -h
  • -?
  • -help
  • nothing entered after the command keyword.
    Note: When nothing is entered after the command keyword, in some cases this could actually execute the command if options are not required.

Help screen syntax conventions

[ ]   Encloses optional parameters
{ }   Encloses mandatory parameters
 |    Separates two or more items, only one of which may be chosen
...   Indicates a repeatable parameter
( )   Repeatable parameter delimiter (not always used)
Command KEYWORDS appear in uppercase
variables, that require you to determine and enter the appropriate input, 
           appear in lowercase
Example command help screen output
The following is the CLP command help screen for the UPDATE MONITOR SWITCHES command:
db2 => ? update monitor
UPDATE MONITOR SWITCHES USING {switch-name {ON | OFF} ...}
[AT DBPARTITIONNUM db-partition-number | GLOBAL]

switch-name:
 BUFFERPOOL, LOCK, SORT, STATEMENT, TABLE, TIMESTAMP, UOW
The following is the system command help screen for the db2look command which, in this case, was not invoked by its specified -h help option:
C:\Program Files\IBM\SQLLIB\BIN>db2look

Syntax: db2look -d DBname [-e] [-xs] [-xdir Path] [-u Creator] [-z Schema]
                          [-t Tname1 Tname2...TnameN] [-tw Tname] [-h]
                          [-o Fname] [-a] [-m] [-c] [-r] [-l] [-x] [-xd] [-f]
                          [-fd] [-td x] [-noview] [-i userID] [-w password]
                          [-v Vname1 Vname2 ... VnameN] [-dp] [-ct]
                          [-wrapper WrapperName] [-server ServerName] [-nofed]
                          [-wlm] [-ap]

                          [-wrapper WrapperName] [-server ServerName][-fedonly] [-nofed]

        db2look [-h]

        -d: Database Name: This must be specified

        -e: Extract DDL file needed to duplicate database
       -xs: Export XSR objects and generate a script containing DDL statements
     -xdir: Path name: the directory in which XSR objects will be placed
        -u: Creator ID: If -u and -a are both not specified then $USER will be used
        -z: Schema name: If -z and -a are both specified then -z will be ignored
        -t: Generate statistics for the specified tables
       -tw: Generate DDLs for tables whose names match the pattern criteria (wildcard 
            characters) of the table name
       -ap: Generate AUDIT USING Statements
      -wlm: Generate WLM specific DDL Statements
        -h: More detailed help message
        -o: Redirects the output to the given file name
        -a: Generate statistics for all creators
        -m: Run the db2look utility in mimic mode
            -c: Do not generate COMMIT statements for mimic
            -r: Do not generate RUNSTATS statements for mimic
        -l: Generate Database Layout: Database partition groups, Bufferpools and Tablespaces
        -x: Generate Authorization statements DDL excluding the original definer of the object
       -xd: Generate Authorization statements DDL including the original definer of the object
        -f: Extract configuration parameters and environment variables
       -td: Specifies x to be statement delimiter (default is semicolon(;))
        -i: User ID to log on to the server where the database resides
        -w: Password to log on to the server where the database resides
   -noview: Do not generate CREATE VIEW ddl statements
  -wrapper: Generates DDLs for federated objects that apply to this wrapper
   -server: Generates DDLs for federated objects that apply to this server
    -FEDONLY: Only created Federated DDL Statements
    -nofed: Do not generate Federated DDL
       -fd: Generates db2fopt statements for opt_buffpage and opt_sortheap along with other 
            cfg and env parameters.
        -v: Generate DDL for view only, this option is ignored when -t is specified
       -dp: Generate DROP statement before CREATE statement
       -ct: Generate DDL Statements by object creation time
Note: In general, a system command help screen tends to provide more detailed information than a CLP command help screen.

Example command inputs

Using the UPDATE MONITOR SWITCHES command help screen as an example,
db2 => ? update monitor
UPDATE MONITOR SWITCHES USING {switch-name {ON | OFF} ...}
[AT DBPARTITIONNUM db-partition-number | GLOBAL]

switch-name:
 BUFFERPOOL, LOCK, SORT, STATEMENT, TABLE, TIMESTAMP, UOW
the following command inputs are valid,
UPDATE MONITOR SWITCHES USING LOCK OFF
UPDATE MONITOR SWITCHES USING LOCK OFF TIMESTAMP ON
UPDATE MONITOR SWITCHES USING STATEMENT ON AT DBPARTITIONNUM 1
UPDATE MONITOR SWITCHES USING SORT ON GLOBAL
while the following command inputs are invalid:
UPDATE MONITOR SWITCHES LOCK OFF
UPDATE MONITOR SWITCHES USING LOCK GLOBAL
UPDATE MONITOR SWITCHES USING STATEMENT ON AT DBPARTITIONNUM 1 GLOBAL

Reminder

To remind yourself about the command help screen syntax conventions without searching the online Information Center, issue the following command at the CLP prompt:
db2 => ? help
or, at the system command prompt, enter the following:
=> db2 ? help