SQLO_QUE_BAD_HANDLE "Bad Queue Handle"
MESSAGE : ZRC=0x870F003E=-2029060034=SQLO_QUE_BAD_HANDLE "Bad Queue Handle" DIA8555C An invalid message queue handle was encountered.
When piping the output of a DB2 command to the head operating system command ("| head"), an operating system error is logged to the db2diag.log
Technote (FAQ)
Question
EINVAL (22) "Invalid argument" LEVEL: Error (OS) error is returned when you pipe the output of a DB2 command to the head operating system command (for example, "db2 list tablespaces show detail | head -81").
Cause
We've added a problem diagnose purpose code in sqlowqueInternal function on DB2 UDB Version 9.
When a command such as "db2 list tablespaces show detail | head -81" or "db2 select * from employee | head -10" is run, DB2® Version 9 logs the following message in the db2diag.log file:
------------------------------------------------------------------------
2007-03-06-23.17.14.080280-300 E10282A659 LEVEL: Error (OS)
PID : 9883690 TID : 1 PROC : db2bp
INSTANCE: hidehy NODE : 000
APPID : *LOCAL.hidehy.070307041048
FUNCTION: DB2 UDB, oper system services, sqlowqueInternal, probe:40
MESSAGE : ZRC=0x870F003E=-2029060034=SQLO_QUE_BAD_HANDLE "Bad Queue Handle"
DIA8555C An invalid message queue handle was encountered.
CALLED : OS, -, write
OSERR : EINVAL (22) "Invalid argument"
DATA #1 : system V message queue identifier., PD_TYPE_SYSV_QUEUE_ID, 4 bytes
0x1DD001B8
DATA #2 : Pointer, 8 bytes
0x0000000110035760
DATA #3 : unsigned integer, 8 bytes
78
------------------------------------------------------------------------
When a command such as db2 "select * from tab1" | more is run (tab1 has a lot of records such as 700000) then run Control + C on HP, will show the message too.
(The same scenario above does not reproduce in Solaris)
Answer
The logging of this message is expected. There is no option to remove the logging of this message. The message can be ignored.
If you pipe the DB2 command output to the less or tail commands, the message will not be written.
If you pipe the output to awk first then pipe to head or others, the message will not be written.
Examples:
$db2 select * from employee | awk '{print $0}' | head -10
$db2 list tablespaces show detail | awk '{print $0}' | head -81