DB2 Version 9.7 for Linux, UNIX, and Windows

SNAP_GET_APPL_INFO table function - Retrieve appl_info logical data group snapshot information

The SNAP_GET_APPL_INFO table function returns information about applications from an application snapshot, in particular, the appl_info logical data group.

Used with the SNAP_GET_AGENT, SNAP_GET_AGENT_MEMORY_POOL, SNAP_GET_APPL, SNAP_GET_APPL_INFO, SNAP_GET_STMT and SNAP_GET_SUBSECTION table functions, the SNAP_GET_APPL_INFO table function provides information equivalent to the GET SNAPSHOT FOR ALL APPLICATIONS CLP command, but retrieves data from all database partitions.

Refer to Table 1 for a complete list of information that can be returned.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-SNAP_GET_APPL_INFO--(--dbname--+------------------+--)------><
                                  '-, dbpartitionnum-'      

The schema is SYSPROC.

Table function parameters

dbname
An input argument of type VARCHAR(128) that specifies a valid database name in the same instance as the currently connected database. Specify a database name that has a directory entry type of either "Indirect" or "Home", as returned by the LIST DATABASE DIRECTORY command. Specify an empty string to take the snapshot from the currently connected database. Specify a NULL value to take the snapshot from all databases within the same instance as the currently connected database.
dbpartitionnum
An optional input argument of type INTEGER that specifies a valid database partition number. Specify -1 for the current database partition, or -2 for an aggregate of all active database partitions. If dbname is not set to NULL and dbpartitionnum is set to NULL, -1 is set implicitly for dbpartitionnum. If this input option is not used, that is, only dbname is provided, data is returned from all active database partitions. An active database partition is a partition where the database is available for connection and use by applications.

If both dbname and dbpartitionnum are set to NULL, an attempt is made to read data from the file created by SNAP_WRITE_FILE procedure. Note that this file could have been created at any time, which means that the data might not be current. If a file with the corresponding snapshot API request type does not exist, then the SNAP_GET_APPL_INFO table function takes a snapshot for the currently connected database and database partition number.

Authorization

One of the following authorizations is required:
  • EXECUTE privilege on the SNAP_GET_APPL_INFO table function.
  • DATAACCESS authority
To access snapshot monitor data, one of the following authorities is also required:
  • SYSMON authority
  • SYSCTRL authority
  • SYSMAINT authority
  • SYSADM authority

Default PUBLIC privilege

In a non-restrictive database, EXECUTE privilege is granted to PUBLIC when the function is automatically created.

Examples

Retrieve the status of all applications on the connected database partition.
SELECT SUBSTR(DB_NAME,1,8) AS DB_NAME, AGENT_ID, 
   SUBSTR(APPL_NAME,1,10) AS APPL_NAME, APPL_STATUS 
   FROM TABLE(SNAP_GET_APPL_INFO(CAST(NULL AS VARCHAR(128)),-1)) AS T
The following example is a sample output from this query.
DB_NAME  AGENT_ID             APPL_NAME  APPL_STATUS
-------- -------------------- ---------- ----------------------
TOOLSDB                    14 db2bp.exe  CONNECTED
SAMPLE                     15 db2bp.exe  UOWEXEC
SAMPLE                      8 javaw.exe  CONNECTED
SAMPLE                      7 db2bp.exe  UOWWAIT

  4 record(s) selected.
The following shows what you obtain when you SELECT from the result of the table function.
SELECT SUBSTR(DB_NAME,1,8) AS DB_NAME, AUTHORITY_LVL 
   FROM TABLE(SNAP_GET_APPL_INFO_V95(CAST(NULL AS VARCHAR(128)),-1)) AS T
The following example is a sample output from this query.
DB_NAME  AUTHORITY_LVL
-------- -----------------------------------------------------.... 
TESTDB   SYSADM(GROUP) + DBADM(USER) + CREATETAB(USER, GROUP) + 
            BINDADD(USER, GROUP) + CONNECT(USER, GROUP) + 
            CREATE_NOT_FENC(USER) + IMPLICIT_SCHEMA(USER, GROUP) + 
            LOAD(USER) + CREATE_EXT_RT(USER) + QUIESCE_CONN(USER)
TESTDB   SYSADM(GROUP) + DBADM(USER) + CREATETAB(USER, GROUP) + 
            BINDADD(USER, GROUP) + CONNECT(USER, GROUP) + 
            CREATE_NOT_FENC(USER) + IMPLICIT_SCHEMA(USER, GROUP) + 
            LOAD(USER) + CREATE_EXT_RT(USER) + QUIESCE_CONN(USER)
TESTDB   SYSADM(GROUP) + DBADM(USER) + CREATETAB(USER, GROUP) + 
            BINDADD(USER, GROUP) + CONNECT(USER, GROUP) + 
            CREATE_NOT_FENC(USER) + IMPLICIT_SCHEMA(USER, GROUP) + 
            LOAD(USER) + CREATE_EXT_RT(USER) + QUIESCE_CONN(USER)

3 record(s) selected.

Information returned

Table 1. Information returned by the SNAP_GET_APPL_INFO table function
Column name Data type Description or corresponding monitor element
SNAPSHOT_TIMESTAMP TIMESTAMP snapshot_timestamp - Snapshot timestamp monitor element
AGENT_ID BIGINT agent_id - Application handle (agent ID)
APPL_STATUS VARCHAR(22) appl_status - Application status . This interface returns a text identifier based on the defines in sqlmon.h, and is one of:
  • BACKUP
  • COMMIT_ACT
  • COMP
  • CONNECTED
  • CONNECTPEND
  • CREATE_DB
  • DECOUPLED
  • DISCONNECTPEND
  • INTR
  • IOERROR_WAIT
  • LOAD
  • LOCKWAIT
  • QUIESCE_TABLESPACE
  • RECOMP
  • REMOTE_RQST
  • RESTART
  • RESTORE
  • ROLLBACK_ACT
  • ROLLBACK_TO_SAVEPOINT
  • TEND
  • THABRT
  • THCOMT
  • TPREP
  • UNLOAD
  • UOWEXEC
  • UOWWAIT
  • WAITFOR_REMOTE
CODEPAGE_ID BIGINT codepage_id - ID of code page used by application
NUM_ASSOC_AGENTS BIGINT num_assoc_agents - Number of associated agents
COORD_NODE_NUM SMALLINT coord_node - Coordinating node
AUTHORITY_LVL VARCHAR(512) authority_lvl - User authorization level .

This interface returns a text identifier based on the database authorities defined in sql.h and their source, and has the following format: authority(source, ...) + authority(source, ...) + ... The source of an authority can be multiple: either from a USER, a GROUP, or a USER and a GROUP.

Possible values for "authority":

  • BINDADD
  • CONNECT
  • CREATE_EXT_RT
  • CREATE_NOT_FENC
  • CREATETAB
  • DBADM
  • IMPLICIT_SCHEMA
  • LOAD
  • LIBADM
  • QUIESCE_CONN
  • SECADM
  • SYSADM
  • SYSCTRL
  • SYSMAINT
  • SYSMON
  • SYSQUIESCE

Possible values for "source":

  • USER - authority granted to the user or to a role granted to the user.
  • GROUP - authority granted to a group to which the user belongs or to a role granted to the group to which the user belongs.
CLIENT_PID BIGINT client_pid - Client process ID
COORD_AGENT_PID BIGINT coord_agent_pid - Coordinator agent
STATUS_CHANGE_TIME TIMESTAMP status_change_time - Application status change time
CLIENT_PLATFORM VARCHAR(12) client_platform - Client operating platform . This interface returns a text identifier based on the defines in sqlmon.h,
  • AIX
  • AIX64
  • AS400_DRDA
  • DOS
  • DYNIX
  • HP
  • HP64
  • HPIA
  • HPIA64
  • LINUX
  • LINUX390
  • LINUXIA64
  • LINUXPPC
  • LINUXPPC64
  • LINUXX8664
  • LINUXZ64
  • MAC
  • MVS_DRDA
  • NT
  • NT64
  • OS2
  • OS390
  • SCO
  • SGI
  • SNI
  • SUN
  • SUN64
  • UNKNOWN
  • UNKNOWN_DRDA
  • VM_DRDA
  • VSE_DRDA
  • WINDOWS
  • WINDOWS95
CLIENT_PROTOCOL VARCHAR(10) client_protocol - Client communication protocol . This interface returns a text identifier based on the defines in sqlmon.h,
  • CPIC
  • LOCAL
  • NETBIOS
  • NPIPE
  • TCPIP (for DB2® UDB)
  • TCPIP4
  • TCPIP6
TERRITORY_CODE SMALLINT territory_code - Database territory code
APPL_NAME VARCHAR(256) appl_name - Application name
APPL_ID VARCHAR(128) appl_id - Application ID
SEQUENCE_NO VARCHAR(4) sequence_no - Sequence number
PRIMARY_AUTH_ID VARCHAR(128) auth_id - Authorization ID
SESSION_AUTH_ID VARCHAR(128) session_auth_id - Session authorization ID
CLIENT_NNAME VARCHAR(128) The client_nname monitor element is deprecated. The value returned is not a valid value.
CLIENT_PRDID VARCHAR(128) client_prdid - Client product/version ID
INPUT_DB_ALIAS VARCHAR(128) input_db_alias - Input database alias
CLIENT_DB_ALIAS VARCHAR(128) client_db_alias - Database alias used by application
DB_NAME VARCHAR(128) db_name - Database name
DB_PATH VARCHAR(1024) db_path - Database path
EXECUTION_ID VARCHAR(128) execution_id - User login ID
CORR_TOKEN VARCHAR(128) corr_token - DRDA® correlation token
TPMON_CLIENT_USERID VARCHAR(256) tpmon_client_userid - TP monitor client user ID
TPMON_CLIENT_WKSTN VARCHAR(256) tpmon_client_wkstn - TP monitor client workstation name
TPMON_CLIENT_APP VARCHAR(256) tpmon_client_app - TP monitor client application name
TPMON_ACC_STR VARCHAR(200) tpmon_acc_str - TP monitor client accounting string
DBPARTITIONNUM SMALLINT The database partition from which the data for the row was retrieved.