Created
September 22, 2018 18:25
-
-
Save gokycat/5e1904b971102d81dd002d5efb8d69ed to your computer and use it in GitHub Desktop.
db2 Force applications script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userid=$1 | |
stmt="SELECT APPLICATION_HANDLE, substr(APPLICATION_NAME,1,20), CLIENT_PID, substr(SYSTEM_AUTH_ID,1,20), (CLIENT_IDLE_WAIT_TIME/1000/60) CLIENT_IDLE_WAIT_TIME_SECS, UOW_COMP_STATUS, timestampdiff(2,char(current timestamp - COALESCE(UOW_STOP_TIME, UOW_START_TIME))) as idle_time_SECS, round((CURRENT TIMESTAMP - CONNECTION_START_TIME),2) as duration_seconds FROM TABLE(MON_GET_CONNECTION(CAST(NULL AS BIGINT), -1)) WHERE NUM_LOCKS_HELD = 0 and timestampdiff(2,char(current timestamp - COALESCE(UOW_STOP_TIME, UOW_START_TIME))) > 300 and SYSTEM_AUTH_ID not in ('DB2INST1', 'CDCADMIN') and SYSTEM_AUTH_ID = '$userid'" | |
echo $stmt | |
for x in `db2 +o connect to rxprod;db2 -x $stmt | awk {'print $1'}`; | |
do db2 "force application($x)"; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment