I'm hoping to get a more in-depth explanation of the following DB2 commands, which all relate to stopping the database in some way, and how they differ from each other.

How do DBAs think about these commands and decide which situations to apply them?

deactivate database

The official documentation doesn't provide more than a couple sentences and usually defines the commands in terms of themselves:

DEACTIVATE DATABASE: This command deactivates the target database on all members in the instance or, a specified member.


TERMINATE: Explicitly terminates the command line processor's back-end process.

After trying to research the difference between the commands, most online explanations consist of people simply parroting the documentation. But what is the real difference? Does anyone have an "in the trenches" view of which circumstances require which of these commands?


Ok, this is really simplified, but hopefully helpful.

DEACTIVATE is the opposite of ACTIVATE. ACTIVATE loads some of the database processes into memory to save time and performance on connections. Otherwise the first connection is where the database does this work. DEACTIVATE takes the processes out of memory. It only "completes" once everyone is logged out. You only have to DEACTIVATE if you ACTIVATE.

TERMINATE shuts down any current connections and any processes run by the command line processor (CLP). It does not necessarily "unload" processes from memory like DEACTIVATE does.

QUIESCE puts the database (or instance) into a "restricted mode" so only IDs with QUIESCE_CONNECT privilege can connect. This is useful for running certain upgrades, etc, when you need the database up, but do not want users on the system. UNQUIESCE takes the database (or instance) out of this mode.

db2stop actually stops the instance. This would be the equivalent of hitting the "off" button, so to speak. db2stop force is a stronger "off" that forces users off the system.

EDIT: As a side note, when you run db2start, if you run it as db2start admin mode, it starts the instance in a state of QUIESCE.

  • 1
    The TERMINATE command stops the background processes of the DB2 command line processor, effectively closing the connection in a particular client session, like a Linux shell instance. It does not affect other sessions, and it has no effect on the DB2 server. – mustaccio Oct 28 '14 at 18:28
  • I would disagree with the "have no effect on the DB2 server". On occasion we had our instance go wierd on us and say "not accepting any more database commands" in the diagnostic log. This has even happened on issuance of db2stop/db2start. A simple issue of db2 terminate appears to resolve the issue and allow the instance to continue. Why? I have no clue. This is now why I issue terminate after db2stop and terminate after db2start. – Chris Aldrich Oct 28 '14 at 20:18
  • TERMINATE affects the CLP session, which you could have on the server, but it does not affect the DB2 server, in the sense of the database manager. TERMINATE does not "flush certain things like catalog entries to disk", no more than closing a database connection does. – mustaccio Oct 28 '14 at 22:39
  • Modified answer to reflect discussion about TERMINATE – Chris Aldrich Oct 30 '14 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy