IBM Books

Administrative API Reference

db2GetSnapshot - Get Snapshot

Collects database manager monitor information and returns it to a user-allocated data buffer. The information returned represents a snapshot of the database manager operational status at the time the API was called.

Scope

This API returns information only for the node on which it is issued.

Authorization

One of the following:

Required Connection

Instance or database:

To obtain a snapshot from a remote instance (or a different local instance), it is necessary to first attach to that instance.

Version

db2ApiDf.h

C API Syntax



/* File: db2ApiDf.h */
/* API: Get Snapshot */
/* ... */
int db2GetSnapshot (
  unsigned char version,
  db2GetSnapshotData * data,
  struct sqlca * pSqlca);
 
typedef struct
{
  sqlma * piSqlmaData;
  sqlm_collected * poCollectedData;
  void * poBuffer;
  db2Uint32 iVersion;
  db2Uint32 iBufferSize;
  db2Uint32 iStoreResult
} db2GetSnapshotData;
/* ... */
 

Generic API Syntax



/* File: db2ApiDf.h */
/* API: Get Snapshot */
/* ... */
int db2GetSnapshot (
  unsigned char version,
  db2GetSnapshotData * data,
  struct sqlca * pSqlca);
 
typedef struct
{
  sqlma * piSqlmaData;
  sqlm_collected * poCollectedData;
  void * poBuffer;
  db2Uint32 iVersion;
  db2Uint32 iBufferSize;
  db2Uint32 iStoreResult
} db2GetSnapshotData;
/* ... */
 

API Parameters

version
Input. Specifies the version and release level of the structure passed in as the second parameter, data.

data
Input/Output. A pointer to the db2GetSnapshotData structure.

pSqlca
Output. A pointer to the sqlca structure. For more information about this structure, see SQLCA.

piSqlmaData
Input. Pointer to the user-allocated sqlma (monitor area) structure. This structure specifies the type(s) of data to be collected. For more information, see SQLMA.

poCollectedData
Output. A pointer to the sqlm_collected structure into which the database monitor delivers summary statistics and the number of each type of data structure returned in the buffer area. For more information about this structure, see SQLM-COLLECTED.
Note:This structure is only used for pre-Version 6 data streams. However, if a snapshot call is made to a back-level remote server, this structure must be passed in for results to be processed. It is therefore recommended that this parameter always be passed in.

poBuffer
Output. Pointer to the user-defined data area into which the snapshot information will be returned. For information about interpreting the data returned in this buffer, see the System Monitor Guide and Reference.

iVersion
Input. Version ID of the database monitor data to collect. The database monitor only returns data that was available for the requested version. Set this parameter to one of the following symbolic constants:

If requesting data for a version higher than the current server, the database monitor only returns data for its level (see the server_version field in the "collected" portion of the data stream.
Note:If SQLM_DBMON_VERSION1 is specified as the version, the APIs cannot be run remotely.

iBufferSize
Input. The length of the data buffer. Use sqlmonsz - Estimate Size Required for sqlmonss() Output Buffer to estimate the size of this buffer. If the buffer is not large enough, a warning is returned, along with the information that will fit in the assigned buffer. It may be necessary to resize the buffer and call the API again.

iStoreResult
Input. An indicator set to TRUE or FALSE, depending on whether the snapshot results are to be stored at the DB2 server for viewing through SQL. This parameter should only be set to TRUE when the snapshot is being taken over a database connection, and when one of the snapshot types in the sqlma is SQLMA_DYNAMIC_SQL.

Usage Notes

If an alias for a database residing at a different instance is specified, an error message is returned.

For detailed information about the use of the database monitor APIs, and for a summary of all database monitor data elements and monitoring groups, see the System Monitor Guide and Reference.

See Also

db2ConvMonStream

sqlmon - Get/Update Monitor Switches

sqlmonsz - Estimate Size Required for sqlmonss() Output Buffer

sqlmrset - Reset Monitor.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]