IBM Books

Quick Beginnings for DB2 Extended Enterprise Edition for UNIX


Commands

You can run the commands sequentially at one database partition server after another, or you can run the commands in parallel. If you run the commands in parallel, you can either choose to have the output sent to a buffer and collected for display (the default behavior) or the output can be displayed at the machine where the command is issued.

To use the rah command, type:

  rah command

To use the db2_all command, type:

  db2_all command

To obtain help about rah syntax, type

  rah "?"

The command can be almost anything which you could type at an interactive prompt, including, for example, multiple commands to be run in sequence. You separate multiple commands using a semicolon (;). Do not use the separator character following the last command.

The following example shows how to use the db2_all command to change the database configuration on all database partition servers that are specified in the db2nodes.cfg file. Because the ; character is placed inside double quotation marks, the request will run concurrently:

  db2_all ";UPDATE DB CFG FOR sample USING LOGFILSIZ=100"
 

Command Descriptions

You can use the following commands:

Command
Description
rah
Runs the command on all machines.
db2_all
Runs the command on all database partition servers that you specify.
db2_kill
Abruptly stops all processes being run on multiple database partition servers and cleans up all resources on all database partition servers. This command renders your databases inconsistent. Do not issue this command except under direction from IBM service.
db2_call_stack
Causes all processes running on all database partition servers to write call traceback to syslog

These commands execute rah with certain implicit settings such as:

Specifying the Command to Run

You can specify the command:

You should use the prompt method if the command contains the following special characters:

   | & ; < > ( ) ` { } [ ] unsubstituted $
The command will be added to your command history just as if you typed it at the prompt. If you specify the command as the parameter on the command line, you must enclose it in double quotation marks if it contains any of the special characters just listed.

All special characters in the command can be entered normally (without being enclosed in quotation marks, except for \). If you need to include a \ in your command, you must type two backslashes (\\).
Note:If you are not using a Korn shell, all special characters in the command can be entered normally (without being enclosed in quotation marks, except for ` " \ unsubstituted $, and the single quotation mark (')). If you need to include one of these characters in your command, you must precede them by three backslashes (\\\). For example, if you need to include a \ in your command, you must type four backslashes (\\\\).

If you need to include a double quotation mark (") in your command, you must precede it by three backslashes, for example, \\\". You cannot include a single quotation mark (') in your command unless your command shell provides some way of entering a single quotation mark inside a singly quoted string.

Running Commands in Parallel

By default, the command is run sequentially at each machine, but you can specify to run the commands in parallel using background rshells by prefixing the command with certain prefix sequences. If the rshell is run in the background, then each command puts the output in a buffer file at its remote machine, This process retrieves the output in two pieces:

  1. After the remote command completes.
  2. After the rshell terminates, which may be later if some processes are still running.

The name of the buffer file is /tmp/$USER/rahout by default, but it can be specified by the environment variables $RAHBUFDIR/$RAHBUFNAME.

When you specify that you want the commands to be run concurrently, by default, this script prefixes an additional command to the command sent to all hosts to check that $RAHBUFDIR and $RAHBUFNAME are usable for the buffer file. It creates $RAHBUFDIR. To suppress this, export an environment variable RAHCHECKBUF=no. You can do this to save time if you know the directory exists and is usable.

Before using rah to run a command concurrently at multiple machines, ensure that:

Monitoring rah Processes

While any remote commands are still running or buffered output is still being accumulated, processes started by rah monitor activity to:

The informative messages are written at an interval controlled by the environment variable RAHWAITTIME. See the help information for details on how specify this. All informative messages can be completely suppressed by exporting RAHWAITTIME=0.

The primary monitoring process is a command whose command name (as shown by the ps command) is rahwait>or. The first informative message tells you the pid (process id) of this process. All other monitoring processes will appear as ksh commands running the rah script (or the name of the symbolic link). If you want, you can stop all monitoring processes by the command:

  kill <pid>

where <pid> is the process ID of the primary monitoring process. Do not specify a signal number. Leave the default of 15. This will not affect the remote commands at all, but will prevent the automatic display of buffered output. Note that there may be two or more different sets of monitoring processes executing at different times during the life of a single execution of rah. However, if at any time you stop the current set, then no more will be started.

If your regular login shell is not a Korn shell (for example /bin/ksh), you can use rah, but there are some slightly different rules on how to enter commands containing the following special characters:

  " ` unsubstituted $ '

For more information, type rah "?". Also, in a UNIX-based environment, if the login shell at the ID which executes the remote commands is not a Korn shell, then the login shell at the ID which executes rah must also not be a Korn shell. (rah makes the decision as to whether the remote ID's shell is a Korn shell based on the local ID). The shell must not perform any substitution or special processing on a string enclosed in single quotation marks. It must leave it exactly as is.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]