DB2 Version 9.7 for Linux, UNIX, and Windows

SNAPCONTAINER administrative view and SNAP_GET_CONTAINER_V91 table function - Retrieve tablespace_container logical data group snapshot information

The SNAPCONTAINER administrative view and the SNAP_GET_CONTAINER_V91 table function return table space snapshot information from the tablespace_container logical data group.

SNAPCONTAINER administrative view

This administrative view allows you to retrieve tablespace_container logical data group snapshot information for the currently connected database.

Used with the SNAPTBSP, SNAPTBSP_PART, SNAPTBSP_QUIESCER and SNAPTBSP_RANGE administrative views, the SNAPCONTAINER administrative view returns data equivalent to the GET SNAPSHOT FOR TABLESPACES 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 authorizations is required:
  • SELECT privilege on the SNAPCONTAINER administrative view
  • CONTROL privilege on the SNAPCONTAINER administrative view
  • DATAACCESS authority
In addition, one of the following privileges or authorities is also 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

Example

Retrieve details for the table space containers for all database partitions for the currently connected database.
SELECT SNAPSHOT_TIMESTAMP, SUBSTR(TBSP_NAME, 1, 15) AS TBSP_NAME, 
   TBSP_ID, SUBSTR(CONTAINER_NAME, 1, 20) AS CONTAINER_NAME, 
   CONTAINER_ID, CONTAINER_TYPE, ACCESSIBLE, DBPARTITIONNUM 
   FROM SYSIBMADM.SNAPCONTAINER ORDER BY DBPARTITIONNUM
The following example is a sample output from this query.
SNAPSHOT_TIMESTAMP         TBSP_NAME       TBSP_ID     ... 
-------------------------- --------------- -------...- ... 
2006-01-08-16.49.24.639945 SYSCATSPACE               0 ... 
2006-01-08-16.49.24.639945 TEMPSPACE1                1 ... 
2006-01-08-16.49.24.639945 USERSPACE1                2 ... 
2006-01-08-16.49.24.639945 SYSTOOLSPACE              3 ... 
2006-01-08-16.49.24.640747 TEMPSPACE1                1 ... 
2006-01-08-16.49.24.640747 USERSPACE1                2 ... 
2006-01-08-16.49.24.639981 TEMPSPACE1                1 ... 
2006-01-08-16.49.24.639981 USERSPACE1                2 ... 
                                                       ... 
8 record(s) selected.                                      
Output from this query (continued).
... CONTAINER_NAME       CONTAINER_ID     CONTAINER_TYPE   ...
... -------------------- ------------...- ---------------- ...
... /home/swalkty/swalkt                0 FILE_EXTENT_TAG  ...
... /home/swalkty/swalkt                0 PATH             ...
... /home/swalkty/swalkt                0 FILE_EXTENT_TAG  ...
... /home/swalkty/swalkt                0 FILE_EXTENT_TAG  ...
... /home/swalkty/swalkt                0 PATH             ...
... /home/swalkty/swalkt                0 FILE_EXTENT_TAG  ...
... /home/swalkty/swalkt                0 PATH             ...
... /home/swalkty/swalkt                0 FILE_EXTENT_TAG  ...
Output from this query (continued).
... ACCESSIBLE DBPARTITIONNUM
... ---------- --------------
...          1              0
...          1              0
...          1              0
...          1              0
...          1              1
...          1              1
...          1              2
...          1              2

SNAP_GET_CONTAINER_V91 table function

The SNAP_GET_CONTAINER_V91 table function returns the same information as the SNAPCONTAINER administrative view, but allows you to retrieve the information for a specific database on a specific database partition, aggregate of all database partitions or all database partitions.

Used with the SNAP_GET_TBSP_V91, SNAP_GET_TBSP_PART_V91, SNAP_GET_TBSP_QUIESCER and SNAP_GET_TBSP_RANGE table functions, the SNAP_GET_CONTAINER_V91 table function returns data equivalent to the GET SNAPSHOT FOR TABLESPACES ON database-alias 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_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

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 example is a sample 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 SNAPCONTAINER administrative view and the SNAP_GET_CONTAINER_V91 table function
Column name Data type Description or corresponding monitor element
SNAPSHOT_TIMESTAMP TIMESTAMP snapshot_timestamp - Snapshot timestamp monitor element
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 The database partition from which the data was retrieved for this row.
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