Here the answers to the questions:
1.Justification why db2 agent is accessing events table
Events table is one of the metadata element of database, which is required for next delta calculations. It is saved and use further. The data is saved on a per-partition basis, it includes data for each database in the target partition.
2.Privilege required for db2 agent to perform its task.
It requires privilege for db2 agent to perform its task. You can follow the steps below to grant privileges:
<DBNAME> is database name where you want to connect.
<UserName> is a user name to which permissions to be granted.
db2 connect to $DBNAME
db2 "GRANT SELECT ON SYSIBMADM.LOG_UTILIZATION TO USER $USERNAME"
db2 "GRANT SELECT ON SYSIBMADM.SNAPDB TO USER $USERNAME"
db2 "GRANT SELECT ON SYSCAT.TABLES TO USER $USERNAME"
db2 "GRANT SELECT ON SYSIBMADM.SNAPTAB TO USER $USERNAME"
db2 "GRANT SELECT ON SYSIBMADM.ADMINTABINFO TO USER $USERNAME"
db2 "GRANT SELECT ON SYSIBMADM.MON_BP_UTILIZATION TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.SNAP_GET_APPL(VARCHAR(),INTEGER) TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.ADMIN_GET_DBP_MEM_USAGE() TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_BUFFERPOOL(VARCHAR(),INTEGER) TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_TABLESPACE(VARCHAR(),INTEGER) TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_PKG_CACHE_STMT(CHAR(),VARCHAR(),CLOB(),INTEGER) TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.SNAP_GET_APPL_INFO_V95(VARCHAR(128), INTEGER) TO USER $USERNAME"
db2 "GRANT SELECT ON SYSIBMADM.MON_LOCKWAITS TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_APPL_LOCKWAIT TO USER $USERNAME"
db2 "GRANT SELECT ON SYSIBMADM.TBSP_UTILIZATION TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_LOCKS(CLOB(),INTEGER) TO USER $USERNAME"
Note1: if your DB2VERSION is equal to "10" OR "11" then also execute following.
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.ENV_GET_DB2_SYSTEM_RESOURCES(INTEGER) TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.ENV_GET_SYSTEM_RESOURCES() TO USER $USERNAME"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_HADR TO USER $USERNAME" >> $LOG_FILENAME 2>&1
Note2: if your DB2VERSION is not equal to "10" OR "11" then execute following.
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.ENV_GET_SYS_RESOURCES() TO USER $USERNAME"
3. If there are no situation associated to EVENTS table (statistic not required), can this access be disabled ?
There is no way to disable it.
4. Which attribute groups and workspaces are involved?
‘Event Monitor’ attribute of KUD_DB2_Database01 and DB2_Database01 (Superseded) attribute group is involved to access event table.
This event monitor attribute is not used in any predefined workspace or situation.
5. What happen if db2 agent is not able to access event table?
DB2 agent access Event table to get count of event monitors defined in the database and use the returned value to determine how many event monitors are defined for the database.
‘Event Monitor’ attribute of KUD_DB2_Database01 and DB2_Database01 (Superseded) attribute group is responsible for this.
‘Event Monitor’ attribute of KUD_DB2_Database01 attribute group is not used in any predefined workspace or situation.
But if you have created a custom workspace/situation on ‘event monitor’ attribute of KUD_DB2_Database0 or DB2_Database01 (Superseded) Attribute group, then you will miss this information.