DB2 10.5 for Linux, UNIX, and Windows

db2gcf - Control DB2 instance command

Starts, stops, or monitors a DB2® instance, usually from an automated script, such as in an HA (high availability) cluster.

On UNIX operating systems, this command is located in INSTHOME/sqllib/bin, where INSTHOME is the home directory of the instance owner. On Windows operating systems, this command is located in the sqllib\bin subdirectory.

Authorization

One of the following authorities:
  • Instance owner
  • Root user authority on Linux and UNIX operating systems or Local Administrator authority on Windows operating systems

Required connection

None

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-db2gcf--+- -u-+--+--------------------+--+-------------+----->
           +- -d-+  '- -i--instance_name-'  '- -h--dbname-'   
           +- -k-+                                            
           +- -s-+                                            
           '- -o-'                                            

>--+------------------------+--+--------------+--+-----+-------->
   |      .-,-------------. |  '- -t--timeout-'  '- -L-'   
   |      V               | |                              
   '- -p----member_number-+-'                              

>--+-----+-----------------------------------------------------><
   '- -?-'   

Command parameters

-u
Starts specified member for specified instance.
-d
Stops specified member for specified instance.
-k
Removes all processes associated with the specified instance. On a DB2 Enterprise Server Edition system, this parameter requires that the remote shell utility rsh or ssh is setup on either a single-partition database instance or a multi-partition database instance.
-s
Returns status of the specified member and the specified instance. The possible states are:
  • Available: The specified member for the specified instance is available for processing.
  • Operable: The instance is installed but not currently available.
  • Not operable: The instance will be unable to be brought to available state.
-o
Returns the default timeouts for each of the possible actions; you can override all these defaults by specifying a value for the -t parameter.
-i instance_name
Instance name to perform action against. If no instance name is specified, the value of DB2INSTANCE is used. If no instance name is specified and DB2INSTANCE is not set, the following error is returned:
db2gcf Error: Neither DB2INSTANCE is set nor instance passed.
-h dbname
Specifies the database name to start, monitor or stop. This option can only be used by the integrated solution with IBM® Tivoli® System Automation for Multiplatforms (SA MP).
-p member_number
In a partitioned database environment, specifies member numbers to perform action against on local node only (remote members are not monitored with this command). Specify the member numbers without any spaces, but separate with commas. If no value is specified, the default is 0. This value is ignored in a single-partition database environment.
-t timeout
Timeout in seconds. The db2gcf command will return unsuccessfully if processing does not complete within the specified period of time. There are default timeouts for each of the possible actions; you can override all these defaults by specifying a value for the -t parameter.
-L
Enables error logging. Instance-specific information will be logged to db2diag log file in the instance log directory. Non-instance specific information will be logged to system log files.
-?
Displays help information. When this option is specified, all other options are ignored, and only the help information is displayed.

Example

  1. The following example starts the instance stevera on member 0:
    db2gcf -u -p 0 -i stevera
    The following output is returned:
    Instance  : stevera
    DB2 Start : Success
    Member 0 : Success
  2. The following example returns the status of the instance stevera on member 0:
    db2gcf -s -p 0 -i stevera
    The following output is returned:
    Instance  : stevera
    DB2 State
    Member 0 :  Available
  3. The following example stops the instance stevera on member 0:
    db2gcf -d -p 0 -i stevera
    The following output is returned:
    Instance  : stevera
    DB2 Stop : Success
    Member 0 : Success

Usage notes

When used together, the -k and -p parameters do not allow all processes to be removed from the specified member. Rather, all processes on the instance (all members) will be removed.

Return codes

The following is a list of all the return codes for this command.
db2gcf Return Values :
0 : db2 service(start,stop,kill) success or db2gcf -s status Available
1 : db2 service(start,stop) failed or db2gcf -s status Not Available
2 : db2gcf has been called with wrong number of parameters
3 : gcfmodule failed to execute the requested service