Technical Blog Post
Abstract
In DB2LUW why SYSIBMADM.LOG_UTILIZATION is returning SQL0801N
Body
Using SYSIBMADM.LOG_UTILIZATION to retrieve log utilization details.
But, getting a SQL0801 error.
Example,
=> db2 "select LOG_UTILIZATION_PERCENT from SYSIBMADM.LOG_UTILIZATION"
LOG_UTILIZATION_PERCENT
-----------------------
SQL0801N Division by zero was attempted. SQLSTATE=22012
This can happen if this Admin View is used in a HADR standby database.
In HADR standby all the columns returned by LOG_UTILIZATION will be zero.
As a result of that the percentage calculation will have a division by zero.
Instead of returning SQL0801N it should return a zero. Which will be fixed in the future DB2 levels.
The internal counters that track log usage are only updated during run-time environment of DB2.
HADR standby is considered to be in recovery state (not run-time state).
So, these values are not tracked.
As a result the monitor will always see 0 for the columns against this function in the standby.
Basically, the LOG_UTILIZATION should not be used in a DB2 HADR standby.
But, it can be faced sometimes as users might have common scripts containing various kinds of monitoring functions to run in both sides of HADR.
Only this step can cause the script to fail with SQL0801N
If it's identified, it will be suggested to modify the script and remove this Admin View from the script for HADR standby.
UID
ibm11139962