DB2 10.5 for Linux, UNIX, and Windows

SNAP_GET_CONTAINER_V91 table function - Retrieve tablespace_container logical data group snapshot information

SNAP_GET_CONTAINER_V91 returns table space snapshot information from the tablespace_container logical data group.

Note: This table function has been deprecated and replaced by the SNAPCONTAINER administrative view and SNAP_GET_CONTAINER table function

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

Syntax

Read syntax diagramSkip visual syntax diagram
>>-SNAP_GET_CONTAINER_V91--(--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 NULL or empty string to take the snapshot from 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_CONTAINER_V91 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_CONTAINER_V91 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 details for the table space containers on the currently connected database on the currently connected database partition.
SELECT SNAPSHOT_TIMESTAMP, TBSP_NAME, TBSP_ID, CONTAINER_NAME, 
   CONTAINER_ID, CONTAINER_TYPE, ACCESSIBLE 
   FROM TABLE(SNAP_GET_CONTAINER_V91('',-1)) AS T
The following is an example of output from this query.
SNAPSHOT_TIMESTAMP         TBSP_NAME            TBSP_ID ... 
-------------------------- -------------------- ------- ... 
2005-04-25-14.42.10.899253 SYSCATSPACE                0 ... 
2005-04-25-14.42.10.899253 TEMPSPACE1                 1 ... 
2005-04-25-14.42.10.899253 USERSPACE1                 2 ... 
2005-04-25-14.42.10.899253 SYSTOOLSPACE               3 ... 
2005-04-25-14.42.10.899253 MYTEMP                     4 ... 
2005-04-25-14.42.10.899253 WHATSNEWTEMPSPACE          5 ... 
Output from this query (continued).
... CONTAINER_NAME                           CONTAINER_ID ...
... ---------------------------------------- ------------ ...
... D:\DB2\NODE0000\SQL00002\SQLT0000.0                 0 ...
... D:\DB2\NODE0000\SQL00002\SQLT0001.0                 0 ...
... D:\DB2\NODE0000\SQL00002\SQLT0002.0                 0 ...
... D:\DB2\NODE0000\SQL00002\SYSTOOLSPACE               0 ...
... D:\DB2\NODE0000\SQL003                              0 ...
... d:\DGTTsWhatsNewContainer                           0 ...
Output from this query (continued).
... CONTAINER_TYPE ACCESSIBLE
... -------------- ----------
... CONT_PATH               1
... CONT_PATH               1
... CONT_PATH               1
... CONT_PATH               1
... CONT_PATH               1
... CONT_PATH               1

Information returned

NOTE: The bufferpool database manager monitor switch must be turned on in order for the file system information to be returned.
Table 1. Information returned by the SNAP_GET_CONTAINER_V91 table function
Column name Data type Description or corresponding monitor element
SNAPSHOT_TIMESTAMP TIMESTAMP The date and time that the snapshot was taken.
TBSP_NAME VARCHAR(128) tablespace_name - Table space name
TBSP_ID BIGINT tablespace_id - Table space identification
CONTAINER_NAME VARCHAR(256) container_name - Container name
CONTAINER_ID BIGINT container_id - Container identification
CONTAINER_TYPE VARCHAR(16) container_type - Container type . This is a text identifier based on the defines in sqlutil.h and is one of:
  • DISK_EXTENT_TAG
  • DISK_PAGE_TAG
  • FILE_EXTENT_TAG
  • FILE_PAGE_TAG
  • PATH
TOTAL_PAGES BIGINT container_total_pages - Total pages in container
USABLE_PAGES BIGINT container_usable_pages - Usable pages in container
ACCESSIBLE SMALLINT container_accessible - Accessibility of container
STRIPE_SET BIGINT container_stripe_set - Stripe set
DBPARTITIONNUM SMALLINT dbpartitionnum - Database partition number monitor element
FS_ID VARCHAR(22) fs_id - Unique file system identification number
FS_TOTAL_SIZE BIGINT fs_total_size - Total size of a file system
FS_USED_SIZE BIGINT fs_used_size - Amount of space used on a file system