DB2 Version 10.1 for Linux, UNIX, and Windows

SNAPUTIL administrative view and SNAP_GET_UTIL table function - Retrieve utility_info logical data group snapshot information

The SNAPUTIL administrative view and the SNAP_GET_UTIL table function return snapshot information about the utilities from the utility_info logical data group.

Depending on if you are using the administrative view or the table function, refer to one of the following sections:

SNAPUTIL administrative view

Used in conjunction with the SNAPUTIL_PROGRESS administrative view, the SNAPUTIL administrative view provides the same information as the LIST UTILITIES SHOW DETAIL 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 authorizations is required to use the view:
  • SELECT privilege on the SNAPUTIL administrative view
  • CONTROL privilege on the SNAPUTIL 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_UTIL 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 utilities and their states on all database members for all active databases in the instance that contains the connected database.
SELECT UTILITY_TYPE, UTILITY_PRIORITY, SUBSTR(UTILITY_DESCRIPTION, 1, 72)
   AS UTILITY_DESCRIPTION, SUBSTR(UTILITY_DBNAME, 1, 17) AS 
   UTILITY_DBNAME, UTILITY_STATE, UTILITY_INVOKER_TYPE, DBPARTITIONNUM 
   FROM SYSIBMADM.SNAPUTIL ORDER BY DBPARTITIONNUM
The following is an example of output from this query.
UTILITY_TYPE     UTILITY_PRIORITY ...
------------...- ---------------- ...
LOAD                            - ...
LOAD                            - ...
LOAD                            - ...
                                     
3 record(s) selected.                
Output from this query (continued).
... UTILITY_DESCRIPTION                                              ...
... -----------------------------------------------------------------...
... ONLINE LOAD DEL AUTOMATIC INDEXING INSERT COPY NO TEST .LOADTEST ...
... ONLINE LOAD DEL AUTOMATIC INDEXING INSERT COPY NO TEST .LOADTEST ...
... ONLINE LOAD DEL AUTOMATIC INDEXING INSERT COPY NO TEST .LOADTEST ...
Output from this query (continued).
... UTILITY_DBNAME    UTILITY_STATE UTILITY_INVOKER_TYPE DBPARTITIONNUM
... ----------------- ------------- -------------------- --------------
... SAMPLE            EXECUTE       USER                              0
... SAMPLE            EXECUTE       USER                              1
... SAMPLE            EXECUTE       USER                              2

SNAP_GET_UTIL table function

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

Used in conjunction with the SNAP_GET_UTIL_PROGRESS table function, the SNAP_GET_UTIL table function provides the same information as the LIST UTILITIES SHOW DETAIL 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_UTIL--(--+--------+--)-----------------------------><
                     '-member-'      

The schema is SYSPROC.

Table function parameter

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 this input option is not used, data will be 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 member is 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_UTIL 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_UTIL 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.

Examples

Example 1: Retrieve a list of utility ids with their type and state for the currently connected database member on database SAMPLE.
SELECT UTILITY_ID, UTILITY_TYPE, UTILITY_STATE 
   FROM TABLE(SNAP_GET_UTIL(-1)) AS T WHERE UTILITY_DBNAME='SAMPLE'
The following is an example of output from this query:
UTILITY_ID           UTILITY_TYPE               STATE
-------------------- -------------------------- --------
                   1 BACKUP                     EXECUTE

  1 record(s) selected.
Example 2: Retrieve a list of utility ids with their type, member number and database partition number for the currently connected database member.
SELECT UTILITY_ID, UTILITY_TYPE, MEMBER, DBPARTITIONNUM
  FROM TABLE(SNAP_GET_UTIL(-1)) AS T
The following is an example of output from this query:
UTILITY_ID  UTILITY_TYPE               MEMBER DBPARTITIONNUM
----------- -------------------------- ------ --------------
          2 BACKUP                          2              2

Information returned

Table 1. Information returned by the SNAPUTIL administrative view and the SNAP_GET_UTIL table function
Column name Data type Description or corresponding monitor element
SNAPSHOT_TIMESTAMP TIMESTAMP The date and time that the snapshot was taken.
UTILITY_ID INTEGER utility_id - Utility ID . Unique to a database partition.
UTILITY_TYPE VARCHAR(26) utility_type - Utility type . This interface returns a text identifier based on the defines in sqlmon.h and is one of:
  • ASYNC_INDEX_CLEANUP
  • ASYNC_PART_DETACH
  • BACKUP
  • CRASH_RECOVERY
  • GROUP_CRASH_RECOVERY
  • LOAD
  • MDC_ROLLOUT_CLEANUP
  • MEMBER_CRASH_RECOVERY
  • REBALANCE
  • REDISTRIBUTE
  • REORG
  • RESTART_RECREATE_INDEX
  • RESTORE
  • ROLLFORWARD_RECOVERY
  • RUNSTATS
UTILITY_PRIORITY INTEGER utility_priority - Utility priority . Priority if utility supports throttling, otherwise null.
UTILITY_DESCRIPTION VARCHAR(2048) utility_description - Utility description . Can be null.
UTILITY_DBNAME VARCHAR(128) utility_dbname - Database operated on by utility
UTILITY_START_TIME TIMESTAMP utility_start_time - Utility start time
UTILITY_STATE VARCHAR(10) utility_state - Utility state . This interface returns a text identifier based on the defines in sqlmon.h and is one of:
  • ERROR
  • EXECUTE
  • WAIT
UTILITY_INVOKER_TYPE VARCHAR(10) utility_invoker_type - Utility invoker type . This interface returns a text identifier based on the defines in sqlmon.h and is one of:
  • AUTO
  • USER
DBPARTITIONNUM SMALLINT dbpartitionnum - Database partition number monitor element
PROGRESS_LIST_ATTR VARCHAR(10) progress_list_attr - Current progress list attributes
PROGRESS_LIST_CUR_SEQ_NUM INTEGER progress_list_current_seq_num - Current progress list sequence number
MEMBER SMALLINT member - Database member monitor element