KSH Script to force all applications from a specified database
When you need to force all applications from just one database,perform this script KSH Script to force all applications from a specified database
To execute this script:
ksh force_applications.ksh <database_name>
#!/bin/ksh
# Kill applications based on application name, application id or client's IP
#---------------------------------------------------------------------------------------------
. ~/sqllib/db2profile
#APPS_TO_KILL=$(db2 list application | grep $1 | awk '{print "db2 \"force application("$3")\""}')
APPS_TO_KILL=$(db2 list application | grep $1 | awk '{print $3}')
echo $APPS_TO_KILL
for APP in $APPS_TO_KILL; do
cmd="db2 force application($APP)"
echo $cmd
ret=$($cmd)
echo $ret
done