DB2 Version 9.7 for Linux, UNIX, and Windows

SNAP_WRITE_FILE procedure

The SNAP_WRITE_FILE procedure writes system snapshot data to a file in the tmp subdirectory of the instance directory.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-SNAP_WRITE_FILE--(--requestType--,--dbname--,--dbpartitionnum--)-><

The schema is SYSPROC.

Procedure parameters

requestType
An input argument of type VARCHAR (32) that specifies a valid snapshot request type. The possible request types are text identifiers based on defines in sqlmon.h, and are one of:
  • APPL_ALL
  • BUFFERPOOLS_ALL
  • DB2
  • DBASE_ALL
  • DBASE_LOCKS
  • DBASE_TABLES
  • DBASE_TABLESPACES
  • DYNAMIC_SQL
dbname
An input argument of type VARCHAR(128) that specifies a valid database name in the same instance as the currently connected database when calling this function. 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 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. An active database partition is a partition where the database is available for connection and use by applications.

If a null value is specified, -1 is set implicitly.

Authorization

To execute the procedure, a user must have SYSADM, SYSCTRL, SYSMAINT, or SYSMON authority. The saved snapshot can be read by users who do not have SYSADM, SYSCTRL, SYSMAINT, or SYSMON authority by passing null values as the inputs to snapshot table functions.

Example

Take a snapshot of database manager information by specifying a request type of 'DB2' (which corresponds to SQLMA_DB2), and defaulting to the currently connected database and current database partition.
CALL SYSPROC.SNAP_WRITE_FILE ('DB2', '', -1)

This will result in snapshot data being written to the instance temporary directory, which is sqllib/tmp/SQLMA_DB2.dat on UNIX operating systems, and sqllib\DB2\tmp\SQLMA_DB2.dat on a Windows operating system.

Usage notes

If an unrecognized input parameter is provided, the following error is returned: SQL2032N The "REQUEST_TYPE" parameter is not valid.