Set the DB2 instance-level parameter KEEPFENCED=YES using the CLP command UPDATE DBM CFG USING KEEPFENCED YES. After restarting the instance, the external stored procedures library will be loaded in memory by DB2 on first invocation of the stored procedure. These shared libraries will remain in memory until you restart the instance. If you are making changes to this external library and copy them into the ~/sqllib/function directory, DB2 will not use it, as the library is already loaded in memory. This is not a DB2 limitation, but rather is the way operating systems are designed to work. (However, you can load and unload a shared library on a mainframe.)

Obviously, you want to set the KEEPFENCED parameter to YES on a production system, and if you have to make changes to your external stored procedures (including splogger), there is a workaround to force DB2 to load the new library. The spalter script uses this approach. It renames the shared library and alters the stored procedures using the new library name. DB2 will load the new library, but the old library will still remain in memory until you recycle the instance.

Making changes to the shared library while KEEPFENCED=YES

                
#! /bin/ksh
TOK=$(date +"%y%m%d%H%M%S")
SHLIBNAME=splogger$TOK
rm -f ~/sqllib/function/splogger*
cp -f splogger ~/sqllib/function/$SHLIBNAME
db2 -tv << !EOF
ALTER PROCEDURE DB2.UPDATE_SP_CONFIG EXTERNAL NAME '${SHLIBNAME}!UpdateSPConfig';
ALTER PROCEDURE DB2.GET_SP_CONFIG    EXTERNAL NAME '${SHLIBNAME}!GetSPConfig';
ALTER PROCEDURE DB2.GET_SP_LOG       EXTERNAL NAME '${SHLIBNAME}!GetSPLog';
ALTER PROCEDURE DB2.OPEN_LOG         EXTERNAL NAME '${SHLIBNAME}!OpenLog';
ALTER PROCEDURE DB2.CLOSE_LOG        EXTERNAL NAME '${SHLIBNAME}!CloseLog';
ALTER PROCEDURE DB2.LOGGER           EXTERNAL NAME '${SHLIBNAME}!Logger';
ALTER PROCEDURE DB2.LOGINFO          EXTERNAL NAME '${SHLIBNAME}!Loginfo';