DB2 Version 9.7 for Linux, UNIX, and Windows

db2GetRecommendations API - Get recommendations to resolve a health indicator in alert state

Retrieves a set of recommendations to resolve a health indicator in alert state on a particular object. The recommendations are returned as an XML document.

Important: This command or API has been deprecated and might be removed in a future release because the health monitor has been deprecated in Version 9.7. For more information, see Health monitor has been deprecated.

Authorization

None

Required connection

Instance. If there is no instance attachment, a default instance attachment is created.

API include file

db2ApiDf.h

API and data structure syntax

SQL_API_RC SQL_API_FN
  db2GetRecommendations (
   db2Uint32 versionNumber,
   void * pParmStruct,
   struct sqlca * pSqlca);

typedef SQL_STRUCTURE db2GetRecommendationsData
{
   db2Uint32 iSchemaVersion;
   db2Uint32 iNodeNumber;
   db2Uint32 iIndicatorID;
   db2Uint32 iObjType;
   char *piObjName;
   char *piDbName;
   char *poRecommendation;
} db2GetRecommendationsData;

db2GetRecommendations API parameters

versionNumber
Input. Specifies the version and release level of the structure passed as the second parameter pParmStruct.
pParmStruct
Input. A pointer to the db2GetRecommendationsData structure.
pSqlca
Output. A pointer to the sqlca structure.

db2GetRecommendationsData data structure parameters

iSchemaVersion
Input. Version ID of the schema used to represent the XML document. The recommendation document will only contain elements or attributes that were defined for that schema version. Set this parameter to: DB2HEALTH_RECSCHEMA_VERSION8_2
iNodeNumber
Input. Specifies the database partition number where the health indicator (HI) entered an alert state. Use the constant SQLM_ALL_NODES to retrieve recommendations for a given object on a given HI across all database partitions. If the HI has the same recommendations on different database partitions, those recommendations will be grouped into a single recommendation set, where the problem is the group of HIs on different database partitions and the recommendations apply to all of these HIs. To retrieve recommendations on the current database partition, use the constant value SQLM_CURRENT_NODE. For standalone instances, SQLM_CURRENT_NODE should be used.
iIndicatorID
Input. The health indicator that has entered an alert state and for which a recommendation is requested. Values are externalized in the header file sqlmon.h in the include directory.
iObjType
Input. Specifies the type of object on which the health indicator (identified by iIndicatorID) entered an alert state. Value values are:
  • DB2HEALTH_OBJTYPE_DBM
  • DB2HEALTH_OBJTYPE_DATABASE
  • DB2HEALTH_OBJTYPE_TABLESPACE
  • DB2HEALTH_OBJTYPE_TS_CONTAINER
piObjName
Input. The name of the table space or table space container when the object type parameter, iObjType, is set to DB2HEALTH_OBJTYPE_TABLESPACE or DB2HEALTH_OBJTYPE_TS_CONTAINER. Specify NULL if not required. In the case of a table space container, the object name is specified as <tablespace name>.<container name>.
piDbname
Input. The alias name for the database on which the HI entered an alert state when the object type parameter, iObjType, is DB2HEALTH_OBJTYPE_TS_CONTAINER, DB2HEALTH_OBJTYPE_TABLESPACE, or DB2HEALTH_OBJTYPE_DATABASE. Specify NULL otherwise.
poRecommendation
Output. Character pointer that will be set to the address of a buffer in memory containing the recommendation text, formatted as an XML document according to the schema provided in sqllib/misc/DB2RecommendationSchema.xsd. The XML document will be encoded in UTF-8, and text in the document will be in the caller's locale.

The xml:lang attribute on the DB2_HEALTH node will be set to the appropriate client language. The API should be considered as a trusted source and the XML document should not be validated. XML is used as a means of structuring the output data. All memory under this pointer is allocated by the engine and must be freed with a db2GetRecommendationsFree call whenever db2GetRecommendations returns with no error.

Usage notes

  • Invoke this API to retrieve a set of recommendations to resolve a health alert on a specific DB2® object. If the input health indicator is not in an alert state on the object identified, an error will be returned.
  • The recommendations are returned as an XML document, and contain information about actions and scripts that can be run to resolve the alert. Any scripts returned by the API must be executed on the instance on which the health indicator entered the alert state. For information about the structure and content of the recommendation XML document returned, refer to the schema at sqllib/misc/DB2RecommendationSchema.xsd
  • All memory allocated by the engine and returned by this function (the recommendation document) must be freed with a db2GetRecommendationsFree call whenever db2GetRecommendations returns with no error.