SNAPTBSP administrative view and SNAP_GET_TBSP table function - Retrieve table space logical data group snapshot information
The SNAPTBSP administrative view and the SNAP_GET_TBSP table function return snapshot information from the table space logical data group.
SNAPTBSP administrative view
This administrative view allows you to retrieve table space logical data group snapshot information for the currently connected database.
Used in conjunction with the SNAPTBSP_PART, SNAPTBSP_QUIESCER, SNAPTBSP_RANGE, SNAPCONTAINER administrative views, the SNAPTBSP administrative view returns information 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
- SELECT privilege on the SNAPTBSP administrative view
- CONTROL privilege on the SNAPTBSP administrative view
- DATAACCESS authority
- DBADM authority
- SQLADM authority
- ACCESSCTRL authority
- SECADM authority
- EXECUTE privilege on the SNAP_GET_TBSP 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 SUBSTR(TBSP_NAME,1,30) AS TBSP_NAME, TBSP_ID, TBSP_TYPE,
TBSP_CONTENT_TYPE FROM SYSIBMADM.SNAPTBSP WHERE DBPARTITIONNUM = 1
TBSP_NAME TBSP_ID TBSP_TYPE TBSP_CONTENT_TYPE
---------- -------...- ---------- -----------------
TEMPSPACE1 1 SMS SYSTEMP
USERSPACE1 2 DMS LONG
2 record(s) selected.
SNAP_GET_TBSP table function
The SNAP_GET_TBSP table function returns the same information as the SNAPTBSP 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 in conjunction with the SNAP_GET_TBSP_PART, SNAP_GET_TBSP_QUIESCER, SNAP_GET_TBSP_RANGE, SNAP_GET_CONTAINER table functions, the SNAP_GET_TBSP table function returns information 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
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 input argument of type INTEGER that specifies a valid member number. Specify -1 for the current member. If the null value is specified, -1 is set implicitly.
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_TBSP table function takes a snapshot for the currently connected database and database member number.
Authorization
- EXECUTE privilege on the SNAP_GET_TBSP 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 SUBSTR(TBSP_NAME,1,10) AS TBSP_NAME, TBSP_ID, TBSP_TYPE,
TBSP_CONTENT_TYPE, DBPARTITIONNUM FROM TABLE(SNAP_GET_TBSP('')) AS T
TBSP_NAME TBSP_ID TBSP_TYPE TBSP_CONTENT_TYPE DBPARTITIONNUM
---------- -------...- ---------- ----------------- --------------
TEMPSPACE1 1 SMS SYSTEMP 1
USERSPACE1 2 DMS LONG 1
SYSCATSPAC 0 DMS ANY 0
TEMPSPACE1 1 SMS SYSTEMP 0
USERSPACE1 2 DMS LONG 0
SYSTOOLSPA 3 DMS LONG 0
TEMPSPACE1 1 SMS SYSTEMP 2
USERSPACE1 2 DMS LONG 2
8 record(s) selected.