DB2 Version 10.1 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--,--member--)----><

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.
member
An input argument of type INTEGER that specifies a valid member number. Specify -1 for the current member, or -2 for an aggregate of all active members. An active member is a member where the database is available for connection and use by applications.

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

Authorization

One of the following authorities is required to execute the procedure:
  • EXECUTE privilege on the procedure
  • DATAACCESS authority
To access snapshot monitor data, one of the following authorities is required:
  • SYSMON authority
  • SYSCTRL authority
  • SYSMAINT authority
  • SYSADM authority
Note: If you do not have SYSMON, SYSADM, SYSCTRL, or SYSMAINT authority, you can read the saved snapshot data by passing null values as the inputs to snapshot functions.

Default PUBLIC privilege

In a non-restrictive database, EXECUTE privilege is granted to PUBLIC when the procedure is automatically created.

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.