db2

What if db2stop fails ?!?

Don’t tell me you haven’t had db2stop fail on you.  Once in a while db2stop would hang especially if you have a hung thread.  If haven’t forced the “hung” thread off the database before you stop db2, db2stop will wait indefinitely. In such cases IBM has db2stop force , but what if that fails. Well you can do these :

1.  Issue kill -9 on all the db2sysc process. This will crash db2 immediately.

2. Then do  ipclean <instance id> .  This will removeDB2 engine and client’s IPC resources.

3. Now you need to clean up the inter-process segments for defunct / db2 processes, for this you can issue :

      ipcs -a | grep <instance id> | awk ‘{print “ipcrm -“$1” “$2}’ | /bin/csh

These would clean up all the resources allocated to db2.

You also do db2_kill to kill db2 and its allegedly do all the above. In DB2 V9 WSE you can issue db2nkill  instead of db2_kill.

You can start up db2 by issuing db2start  . Be real careful before you issue kill -9 command on db2sysc or db2_kill,  use it as a last option. Its will render all the database to be inconsistent if it has inflight transaction during the “kill”.  It will attempt to do a crash recovery when it starts backup, but you will risk all the inflight transactions.