SQL0802N Arithmetic overflow or other arithmetic exception occurred for count(*) Query

While working with count function with huge data set you will get error SQL0802N  Arithmetic overflow or other arithmetic exception occurred. SQLSTATE=22003. You might also receive sqlcode -802, sqlstate 22003 error in your application log. You might get confused by seeing error Arithmetic overflow or other arithmetic exception occurred. for count function.

SQL0802N  Arithmetic overflow or other arithmetic exception occurred


SQL1768N Unable to start HADR. Reason code = "5"

While initializing DB2 HADR you might receive error  SQL1768N  Unable to start HADR. Reason code = "5".  There are multiple scenario in which you might receive SQL1768N  Reason Code 5. In this blog we will go through scenarios in which you might get this error and solution to fix it. IBM documentation list below explanation for this error:


SQL1768N Unable to start HADR. Reason code = "<reason-code>".

Explanation:

The explanation corresponding to the reason code is:

5         Invalid service name for the hadr_local_svc configuration parameter.

User response:

The user response corresponding to the reason code is:

5      Ensure that the hadr_local_svc configuration parameter is set to a valid service name. For Unix platforms, edit the          /etc/services file. For Windows, edit %SystemRoot%\system32\drivers\etc\services. Alternatively, a literal port number can be specified for this parameter.

SQL10007N Message "-1390" could not be retrieved. Reason code: "3"

When working with remote databases you might receive error SQL10007N Message "-1390" could not be retrieved.  Reason code: "3". You might receive SQL10007 Reason Code 3 in  your application as well. IBM documentation list below explanation for this error



SQL10007N Message "<msgno>" could not be retrieved. Reason code: "<code>".

Explanation:

The requested message <msgno> could not be retrieved from the message file. Reason code <code> is one of the following:

SQL0803N SQLSTATE=23505 Error on table with IDENTITY column

SQL0803N SQLSTATE=23505 or SQLCODE=-803 SQLSTATE=23505 error in DB2 LUW indicates you are trying to Insert, Update row which violates Primary Key, Unique Constraint or Unique index on a table. This error on a table for which Primary Key column is IDENTIY column with GENERATED BY DEFAULT or GENERATED ALWAYS seems strange, since DB2 itself take care of generating unique value for IDENTITY column. You might get SQL0803N error when running insert from CLI and in application error log you might get see error SQLCODE=-803 SQLSTATE=23505.

This issue happens when IDENTITY column generate value which is already present in table. You can observer this anomaly in below scenarios: 

db2_deinstall error : DBI20081E The installer detected that there is not enough free disk space

During DB2 client uninstall you can encounter error DBI20081E  The installer detected that there is not enough free disk space in "/tmp". Free space detected in "/tmp" is: "1811268" (measured in kilobytes). Space needed is: "2000000" (measured in kilobytes).  If free size in /tmp is less than 2000000 KB you will hit this error even though /tmp space requirement is only 512 MB for non pureScale environment as per IBM Knowledge Center. I successfully reproduced this issue with DB2 11.1 FP 2b and 11.5.4 client.

DB2 installation issue : The hostname is invalid

During DB2 installation you might get error The hostname is invalid. We get this error if your hostname is not properly configured and mapped to an IP Address which is reachable.

While performing DB2 installation using db2setup command you might get below error screen.

Same solution is valid for error during installation with db2_install command.

db2idrop issue : The specified instance does not exist

You might come across scenario where db2ilist return DB2 instance name but that instance does not exist. Such situation might arise due to failed db2idrop, sqllib directory missing in DB2 instance user home directory or someone messed up with your instance home directory.

db2ilist