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
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