IBM Books

Command Reference

ATTACH

Enables an application to specify the instance at which instance-level commands (CREATE DATABASE and FORCE APPLICATION, for example) are to be executed. This instance may be the current instance, another instance on the same workstation, or an instance on a remote workstation.

Authorization

None

Required Connection

None. This command establishes an instance attachment.

Command Syntax

>>-ATTACH----+---------------+---------------------------------->
             '-TO--nodename--'
 
>-----+-----------------------------------------------------------------------------+>
      '-USER--username--+--------------------------------------------------------+--'
                        +-USING--password--+-----------------------------------+-+
                        |                  '-NEW--password--CONFIRM--password--' |
                        '-CHANGE PASSWORD----------------------------------------'
 
>--------------------------------------------------------------><
 

Command Parameters

TO nodename
Alias of the instance to which the user wants to attach. This instance must have a matching entry in the local node directory. The only exception to this is the local instance (as specified by the DB2INSTANCE environment variable) which may be specified as the object of an attach, but which cannot be used as a node name in the node directory.

USER username
Specifies the authentication identifier.

USING password
Specifies the password for the user name. If a user name is specified, but a password is not specified, the user is prompted for the current password. The password is not displayed at entry.

NEW password
Specifies the new password that is to be assigned to the user name. Passwords can be up to 18 characters in length. The system on which the password will be changed depends on how user authentication has been set up.

CONFIRM password
A string that must be identical to the new password. This parameter is used to catch entry errors.

CHANGE PASSWORD
If this option is specified, the user is prompted for the current password, a new password, and for confirmation of the new password. Passwords are not displayed at entry.

Examples

Catalog two remote nodes:

   db2 catalog tcpip node node1 remote freedom server server1
   db2 catalog tcpip node node2 remote flash server server1

Attach to the first node, force all users, and then detach:

   db2 attach to node1
   db2 force application all
   db2 detach

Attach to the second node, and see who is on:

   db2 attach to node2
   db2 list applications

After the command returns agent IDs 1, 2 and 3, force 1 and 3, and then detach:

   db2 force application (1, 3)
   db2 detach

Attach to the current instance (not necessary, will be implicit), force all users, then detach (AIX only):

   db2 attach to $DB2INSTANCE
   db2 force application all
   db2 detach

Usage Notes

If nodename is omitted from the command, information about the current state of attachment is returned.

If ATTACH has not been executed, instance-level commands are executed against the current instance, specified by the DB2INSTANCE environment variable.

See Also

DETACH.


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

[ DB2 List of Books | Search the DB2 Books ]