SNAPAGENT administrative view and SNAP_GET_AGENT table function - Retrieve agent logical data group application snapshot information
The SNAPAGENT administrative view and the SNAP_GET_AGENT table function return information about agents from an application snapshot, in particular, the agent logical data group.
SNAPAGENT administrative view
This administrative view allows you to retrieve agent logical data group application snapshot information for the currently connected database.
Used with the MON_GET_CONNECTION, MON_GET_MEMORY_POOL, and MON_GET_MEMORY_SET table functions and the MON_CURRENT_SQL and SNAPSUBSECTION administrative views, the SNAPAGENT administrative view provides information equivalent to the GET SNAPSHOT FOR APPLICATIONS ON database-alias CLP command, but retrieves data from all database members.
The schema is SYSIBMADM.
Refer to Table 1 for a complete list of information that can be returned.
Authorization
- SELECT privilege on the SNAPAGENT administrative view
- CONTROL privilege on the SNAPAGENT administrative view
- DATAACCESS authority
- DBADM authority
- SQLADM authority
- EXECUTE privilege on the SNAP_GET_AGENT table function
- DATAACCESS authority
- DBADM authority
- SQLADM authority
- 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
SELECT * FROM SYSIBMADM.SNAPAGENT
SNAPSHOT_TIMESTAMP DB_NAME AGENT_ID ...
-------------------------- -------...- ---------...--- ...
2005-07-19-11.03.26.740423 SAMPLE 101 ...
2005-07-19-11.03.26.740423 SAMPLE 49 ...
...
2 record(s) selected. ...
... AGENT_PID LOCK_TIMEOUT_VAL DBPARTITIONNUM
... -------------------- -------------------- --------------
... 11980 -1 0
... 15940 -1 0
...
...
SNAP_GET_AGENT table function
The SNAP_GET_AGENT table function returns the same information as the SNAPAGENT 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_MEMORY_POOL, SNAP_GET_APPL, SNAP_GET_APPL_INFO, SNAP_GET_STMT and SNAP_GET_SUBSECTION table functions, the SNAP_GET_AGENT table function provides information equivalent to the GET SNAPSHOT FOR ALL APPLICATIONS CLP command, but retrieves data from all database members.
Refer to Table 1 for a complete list of information that can be returned.
Syntax
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 table function takes a snapshot for the currently connected database and database member number.
Authorization
- EXECUTE privilege on the SNAP_GET_AGENT table function
- DATAACCESS authority
- 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
SELECT * FROM TABLE(SNAP_GET_AGENT(CAST(NULL AS VARCHAR(128)), -1)) AS T
SNAPSHOT_TIMESTAMP DB_NAME AGENT_ID ...
-------------------------- -------...- --------...-- ...
2006-01-03-17.21.38.530785 SAMPLE 48 ...
2006-01-03-17.21.38.530785 SAMPLE 47 ...
2006-01-03-17.21.38.530785 SAMPLE 46 ...
2006-01-03-17.21.38.530785 TESTDB 30 ...
2006-01-03-17.21.38.530785 TESTDB 29 ...
2006-01-03-17.21.38.530785 TESTDB 28 ...
6 record(s) selected.
... AGENT_PID LOCK_TIMEOUT_VAL DBPARTITIONNUM
... ---------...---- -------------------- --------------
... 7696 -1 0
... 8536 -1 0
... 6672 -1 0
... 2332 -1 0
... 8360 -1 0
... 6736 -1 0
...
Information returned
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) |
LOCK_TIMEOUT_VAL | BIGINT | lock_timeout_val - Lock timeout (seconds) |
DBPARTITIONNUM | SMALLINT | dbpartitionnum - Database partition number monitor element |
MEMBER | SMALLINT | member - Database member monitor element |