db_query_history

With this tool, you can capture Db2 query history or package-cache information in persistent tables.

Usage

db_query_history [-h] [-host HOST] [-db DB] [-dsn DSN] [-schema SCHEMA] [-user USER] [-pw PW]

Basic parameters

-h | --help
Displays help for the command.

Optional parameters

-host HOST
Specifies the hostname for which you want to get details.

Localhost is the default value.

-db DB
Specifies the database for which you want to get stats. The default is BLUDB.
-dsn DSN
An alternative for the -db and -host options.
-schema SCHEMA
Specifies the schema Query History. The default is NZQHIST.
-user USER
Specifies the database user.
-pw PW
Specifies the database password.

Examples

  • With DSN:
    [bluadmin@sailss1 - Db2wh tools]$   ./db_query_history -schema abcde -dsn pslv4
    'DB_USER' not exported. Enter username for BLUDB: bluadmin
    'DB_PASSWORD' not exported. Enter password for bluadmin@BLUDB:
    Schema ABCDE created.
    Creating objects and recording Query History...
    Creating and updating history table EVENT_ACTIVITY
    Creating and updating history table SQL_FACT
    Creating and updating history table SQL_DIM
    Query History tables created and populated.
    [bluadmin@sailss1 - Db2wh tools]$
  • Without DSN:
    [bluadmin@sailss1 - Db2wh tools]$   ./db_query_history -schema abcde
    'DB_USER' not exported. Enter username for BLUDB: bluadmin
    'DB_PASSWORD' not exported. Enter password for bluadmin@BLUDB:
    Schema ABCDE created.
    Creating objects and recording Query History...
    Creating and updating history table EVENT_ACTIVITY
    Creating and updating history table SQL_FACT
    Creating and updating history table SQL_DIM
    Query History tables created and populated.
    [bluadmin@sailss1 - Db2wh tools]$
  • With host:
    [bluadmin@sailss1 - Db2wh tools]$   ./db_query_history -schema abcde -host 9.70.140.204
    'DB_USER' not exported. Enter username for BLUDB: bluadmin
    'DB_PASSWORD' not exported. Enter password for bluadmin@BLUDB:
    Schema ABCDE exists.
    Proceeding to populate Query History tables ...
    Synching EVENT_ACTIVITY ..
    Synching SQL_FACT ..
    Synching SQL_DIM ..
    [bluadmin@sailss1 - Db2wh tools]$

Examples

  • [bluadmin@host - Db2wh support_tools]$ db_query_history -schema NZHIST12
    Schema NZHIST12 created.
    Creating objects and recording Query History...
    Creating and updating history table EVENT_ACTIVITY
    Creating and updating history table SQL_FACT
    Creating and updating history table SQL_DIM
    Query History tables created and populated.
    [bluadmin@host - Db2wh support_tools]$ db_query_history -schema NZHIST12
    Schema NZHIST12 exists.
    Proceeding to populate Query History tables ...
    Synching EVENT_ACTIVITY ..
    Synching SQL_FACT ..
    Synching SQL_DIM ..