DB2 10.5 for Linux, UNIX, and Windows

SNAPAGENT_MEMORY_POOL administrative view and SNAP_GET_AGENT_MEMORY_POOL table function - Retrieve memory_pool logical data group snapshot information

The SNAPAGENT_MEMORY_POOL administrative view and the SNAP_GET_AGENT_MEMORY_POOL table function return information about memory usage at the agent level.

Important: The SNAPAGENT_MEMORY_POOL administrative view and SNAP_GET_AGENT_MEMORY_POOL table function have been deprecated and replaced by the MON_GET_MEMORY_POOL table function - get memory pool information and MON_GET_MEMORY_SET table function - get memory set information.
Depending on if you are using the administrative view or the table function, refer to one of the following sections:

SNAPAGENT_MEMORY_POOL administrative view

This administrative view allows you to retrieve the memory_pool logical data group snapshot information about memory usage at the agent level for the currently connected database.

Used with the MON_GET_AGENT and MON_GET_CONNECTION table functions and the MON_CURRENT_SQL and SNAPSUBSECTION administrative views, the SNAPAGENT_MEMORY_POOL administrative view provides information equivalent to the GET SNAPSHOT FOR APPLICATIONS ON database-alias CLP command.

The schema is SYSIBMADM.

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

Authorization

One of the following is required to use the view:
  • SELECT privilege on the SNAPAGENT_MEMORY_POOL administrative view
  • CONTROL privilege on the SNAPAGENT_MEMORY_POOL administrative view
  • DATAACCESS authority
  • DBADM authority
  • SQLADM authority
One of the following is required to use the table function:
  • EXECUTE privilege on the SNAP_GET_AGENT_MEMORY_POOL table function
  • DATAACCESS authority
  • DBADM authority
  • SQLADM authority
In addition, to access snapshot monitor data, one of the following authorities is also required:
  • SYSMON
  • SYSCTRL
  • SYSMAINT
  • SYSADM

Default PUBLIC privilege

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

Example

Retrieve a list of memory pools and their current size.
SELECT AGENT_ID, POOL_ID, POOL_CUR_SIZE FROM SYSIBMADM.SNAPAGENT_MEMORY_POOL
The following is an example of output from this query.
AGENT_ID       POOL_ID POOL_  CUR_SIZE
--------...--- -------------- ---------...------
            48 APPLICATION                 65536
            48 OTHER                       65536
            48 APPL_CONTROL                65536
            47 APPLICATION                 65536
            47 OTHER                      131072
            47 APPL_CONTROL                65536
            46 OTHER                      327680
            46 APPLICATION                262144
            46 APPL_CONTROL                65536

9 record(s) selected.

SNAP_GET_AGENT_MEMORY_POOL table function

The SNAP_GET_AGENT_MEMORY_POOL table function returns the same information as the SNAPAGENT_MEMORY_POOL administrative view, but allows you to retrieve the information for a specific database on a specific database member, aggregate of all database members or all database members.

Used with the SNAP_GET_AGENT, SNAP_GET_APPL, SNAP_GET_APPL_INFO, SNAP_GET_STMT and SNAP_GET_SUBSECTION table functions, the SNAP_GET_AGENT_MEMORY_POOL table function provides information equivalent to the GET SNAPSHOT FOR ALL APPLICATIONS CLP command.

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

Syntax

Read syntax diagramSkip visual syntax diagram
>>-SNAP_GET_AGENT_MEMORY_POOL--(--dbname--+----------+--)------><
                                          '-, member-'      

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.
member
An optional input argument of type INTEGER that specifies a valid database member number. Specify -1 for the current database member, or -2 for an aggregate of all active database members. If dbname is not set to NULL and member is set to NULL, -1 is set implicitly for member. If this input option is not used, that is, only dbname is provided, data is returned from all active database members. An active database member is a member where the database is available for connection and use by applications.

If both dbname and member 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_AGENT_MEMORY_POOL table function takes a snapshot for the currently connected database and database member number.

Authorization

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

Default PUBLIC privilege

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

Example

Retrieve a list of memory pools and their current size for all databases.
SELECT SUBSTR(DB_NAME,1,8) AS DB_NAME, AGENT_ID, POOL_ID, POOL_CUR_SIZE 
   FROM TABLE(SNAP_GET_AGENT_MEMORY_POOL(CAST (NULL AS VARCHAR(128)), -1)) 
   AS T
The following is an example of output from this query.
DB_NAME  AGENT_ID       POOL_ID        POOL_CUR_SIZE
-------- --------...--- -------------- --------------------
SAMPLE               48 APPLICATION                   65536
SAMPLE               48 OTHER                         65536
SAMPLE               48 APPL_CONTROL                  65536
SAMPLE               47 APPLICATION                   65536
SAMPLE               47 OTHER                        131072
SAMPLE               47 APPL_CONTROL                  65536
SAMPLE               46 OTHER                        327680
SAMPLE               46 APPLICATION                  262144
SAMPLE               46 APPL_CONTROL                  65536
TESTDB               30 APPLICATION                   65536
TESTDB               30 OTHER                         65536
TESTDB               30 APPL_CONTROL                  65536
TESTDB               29 APPLICATION                   65536
TESTDB               29 OTHER                        131072
TESTDB               29 APPL_CONTROL                  65536
TESTDB               28 OTHER                        327680
TESTDB               28 APPLICATION                   65536
TESTDB               28 APPL_CONTROL                  65536

18 record(s) selected.

Information returned

Table 1. Information returned by the SNAPAGENT_MEMORY_POOL administrative view and the SNAP_GET_AGENT_MEMORY_POOL table function
Column name Data type Description or corresponding monitor element
SNAPSHOT_TIMESTAMP TIMESTAMP The date and time that the snapshot was taken.
DB_NAME VARCHAR(128) db_name - Database name
AGENT_ID BIGINT agent_id - Application handle (agent ID)
AGENT_PID BIGINT agent_pid - Engine dispatchable unit (EDU)
POOL_ID VARCHAR(14) pool_id - Memory pool identifier . This interface returns a text identifier based on defines in sqlmon.h, and is one of:
  • APP_GROUP
  • APPL_CONTROL
  • APPLICATION
  • BP
  • CAT_CACHE
  • DATABASE
  • DFM
  • FCMBP
  • IMPORT_POOL
  • LOCK_MGR
  • MONITOR
  • OTHER
  • PACKAGE_CACHE
  • QUERY
  • SHARED_SORT
  • SORT
  • STATEMENT
  • STATISTICS
  • UTILITY
POOL_CUR_SIZE BIGINT pool_cur_size - Current size of memory pool
POOL_WATERMARK BIGINT pool_watermark - Memory pool watermark
POOL_CONFIG_SIZE BIGINT pool_config_size - Configured size of memory pool
DBPARTITIONNUM SMALLINT dbpartitionnum - Database partition number monitor element
MEMBER SMALLINT member - Database member monitor element