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

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

Important: The SNAPCONTAINER administrative view and the SNAP_GET_CONTAINER table function are deprecated and have been replaced by the MON_GET_CONTAINER table function - Get table space container metrics.
Depending on if you are using the administrative view or the table function, refer to one of the following sections:

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 MON_GET_TABLESPACE table function and the SNAPTBSP_QUIESCER SNAPTBSP_RANGE administrative view, 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 to use the view:
  • SELECT privilege on the SNAPCONTAINER administrative view
  • CONTROL privilege on the SNAPCONTAINER 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_CONTAINER 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 details for the table space containers for all database members 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 is an example of 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 table function

The SNAP_GET_CONTAINER 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 member, aggregate of all database members or all database members.

Used with the SNAP_GET_TBSP, SNAP_GET_TBSP_PART, SNAP_GET_TBSP_QUIESCER and SNAP_GET_TBSP_RANGE table functions, the SNAP_GET_CONTAINER 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 diagramSNAP_GET_CONTAINER(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 NULL or empty string to take the snapshot from 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 members where the database is active.

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_CONTAINER table function takes a snapshot for the currently connected database and database member.

Authorization

One of the following authorizations is required:
  • EXECUTE privilege on the SNAP_GET_CONTAINER 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 member.
SELECT SNAPSHOT_TIMESTAMP, TBSP_NAME, TBSP_ID, CONTAINER_NAME, 
   CONTAINER_ID, CONTAINER_TYPE, ACCESSIBLE 
   FROM TABLE(SNAP_GET_CONTAINER('',-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 SNAPCONTAINER administrative view and the SNAP_GET_CONTAINER 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