Attaching to and detaching from instances

On all platforms, to attach to another instance of the database manager, which might be remote, use the ATTACH command. To detach from an instance, use the DETACH command.

Before you begin

More than one instance must exist.

Procedure

  • To attach to an instance:
    • Enter the ATTACH command from the command line.
    • Call the sqleatin API from a client application.
  • To detach from an instance:
    • Enter the DETACH from the command line.
    • Call the sqledtin API from a client application.

Example

For example, to attach to an instance called testdb2 that was previously cataloged in the node directory:
    db2 attach to testdb2
After performing maintenance activities for the testdb2 instance, detach from an instance:
    db2 detach