The Informix “onclean” command was introduced in Informix 11.  I am sure that most Informix DBAs have occasionally faced a situation where the Informix instance won’t come online due to an improper shutdown, killed process, interrupted restore, or an instance crash. In these cases, the DBA has often had to ask their systems administrator to remove memory segments or to kill processes by using the “ipcrm” or “kill” commands, unless you have “sudo” capability or you are wearing the Unix admin hat as well. On the Unix O/S you should be Informix or root and on Windows you need to be under the Informix-Admin group to run these commands.

The Informix “onclean” utility is an excellent tool to clean up the hanging memory segments.  Basically, this will remove any remaining shared memory segments and semaphores, stop the Informix instance and clean the $INFORMIXDIR/etc/.conf.$INFORMIXSERVER file, when the normal “onmode -ky” command won’t work.  Extra precaution needs to be taken before running this command to confirm that you are pointing to the correct instance, including checking your INFORMIXSERVER, INFORMIXDIR, and ONCONFIG environment settings, particularly when you have multiple Informix instances on the server.  Also remember that this will bring the instance down instantly, not allowing any transactions to complete. However, they should be rolled back during fast recovery on restart.

Important: Use “onclean” only if you are unable to run the “onmode” command successfully. As always, check the online log before taking any further action. Just run “onclean” initially and if needed it will ask you to pass the “-k” flag, in which case the command will be “onclean –k” and of course “-y” for confirmation.

onclean –ky

-k  Shuts down Informix instance which is online by stopping virtual processes and attempting to clean up the remaining semaphores and shared memory segments, if they are running.

–V  Short version information.

–version Full version information.

–y  Prompt for confirmation.