IBM Support

[Db2] How to check whether the database has been activated explicitly.

How To


Summary

By default, a Db2 database activates implicitly by an incoming database connection, and deactivates implicitly if all the database connections gone away.
However, unexpected deactivate database can cause poor performance in later database requests.
So, it's important to activate a database explicitly by ACTIVATE DATABASE command from performance point of view.

Objective

This note guides you on how to check whether a database is acitvated explicitly or implicitly.

Environment

Db2 V10.5 or later.

Steps

There are two methods to check whether given database is activated explicitly.
  • Check DB_ACTIVATION_STATE in MON_GET_DATABASE table function
    1. Connect to the database
      db2 connect to <database_name>
    2. Query MON_GET_DATABASE. DB_ACTIVATION_STATE=NONE means the database is activated implicitly, and EXPLICIT means the database is activated explicitly.
      db2 "select DB_CONN_TIME, DB_ACTIVATION_STATE from table(mon_get_database(-1)) as t"
      
      DB_CONN_TIME               DB_ACTIVATION_STATE
      -------------------------- -------------------
      2021-09-14-08.20.46.000000 NONE
  • Check START: DATABASE entries in db2diag.log 
    Run the db2diag command as follows, ACTIVATED: NO means the database is activated implicitly, and ACTIVATED: YES means the database is activated explicitly.
    NOTE: The following example prints last 7 days in the db2diag.log.
    db2diag -gi db=<database_name>,funcname:=sqeLocalDatabase -H 7d

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"ARM Category":[{"code":"a8m500000008PkgAAE","label":"Database Objects"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.5.0;11.1.0;11.5.0"}]

Document Information

Modified date:
11 September 2022

UID

ibm16502945