Estimates the buffer size needed by db2GetSnapshot - Get Snapshot.
Scope
This API only affects the instance to which the calling application is attached.
Authorization
One of the following:
Required Connection
Instance or database:
To obtain information from a remote instance (or a different local instance), it is necessary to first attach to that instance. If an attachment does not exist, an implicit instance attachment is made to the node specified by the DB2INSTANCE environment variable.
Version
sqlmon.h
C API Syntax
/* File: sqlmon.h */ /* API: Estimate Size Required for sqlmonss() Output Buffer */ /* ... */ int SQL_API_FN sqlmonsz ( unsigned long version, _SQLOLDCHAR *reserved, sqlma *sqlma_ptr, unsigned long *buff_size, struct sqlca *sqlca); /* ... */ |
Generic API Syntax
/* File: sqlmon.h */ /* API: Estimate Size Required for sqlmonss() Output Buffer */ /* ... */ int SQL_API_FN sqlgmnsz ( unsigned long reserved_lgth, struct sqlca *sqlca, unsigned long *buff_size, sqlma *sqlma_ptr, _SQLOLDCHAR *reserved, unsigned long version); /* ... */ |
API Parameters
Note: | If SQLM_DBMON_VERSION1 is specified as the version, the APIs cannot be run remotely. |
Sample Programs
Usage Notes
This function generates a significant amount of overhead. Allocating and freeing memory dynamically for each db2GetSnapshot call is also expensive. If calling db2GetSnapshot repeatedly, for example, when sampling data over a period of time, it may be preferable to allocate a buffer of fixed size, rather than call sqlmonsz.
If the database system monitor finds no active databases or applications, it may return a buffer size of zero (if, for example, lock information related to a database that is not active is requested). Verify that the estimated buffer size returned by this API is non-zero before calling db2GetSnapshot - Get Snapshot. If an error is returned by db2GetSnapshot because of insufficient buffer space to hold the output, call this API again to determine the new size requirements.
See Also
sqlmon - Get/Update Monitor Switches