Using the command line on UNIX and Linux

This topic describes how to use a command line to perform actions against a IBM® Db2® instance under UNIX® or Linux®.

If the Db2 Control Center is unavailable or you do not have access to a graphical user interface, you can use a command line to execute Db2 commands such as starting and stopping an instance.
Important: If you are using DB2® 10.1 or higher, you must use the command-line interface.
To use a command line to perform actions against an instance of Db2, complete the following steps:
  1. Log in with a user ID or name that has ROOT, SYSADM, SYSCTRL, or SYSMAINT authority on the instance; or log in as the instance owner.
  2. Run the startup script:
    • For Bourne or Korn shell, type: . HOME/sqllib/db2profile.
    • For C shell, type: source HOME/sqllib/db2cshrc.
    where HOME is the home directory of the instance you want to use.
  3. To start the instance using the command line, type db2start.
    Note: When you run commands to start the database manager instance, the Db2 database manager applies the command to the current instance.
  4. To stop the instance using the command line, type db2stop.
    Note: When you run commands to stop the database manager instance, the Db2 database manager applies the command to the current instance.