We use db2 stop to try to stop the database but something is still running and connected to the database. We have been told to deactivate the database to bring it down completely. Can anyone suggest a way to bring db2 to a complete stop like pulling the rug from under it's feet?
Hello Mark, to see what's connected to the db, run 'db2 list applications'
If you need to disconnect a session, run 'db2 force application (<handle-number>) or 'db2 force application all'. If you don't care what's connected, you can run 'db2stop force' to close all connections and shutdown the instance.
BTW, if you do not explicitly activate the db, it will automatically deactivate when the last user disconnects. To prevent this happening, just run 'db2 activate db <db-name>'.
We do the db2 stop force and the application all commands. It is though that something is still hanging on. I am going to be putting in a call to IBM and see what they have to say but thank you for your reply, i appreciate it
We found out that the backend process was still hanging on, b2bp, don't know why, the force application all should have handled that. So now we do a force application all, terminate, and stop force all within a loop. Wait some time and then check for the backend process, if it is there, grab the PID and kill it and move on
A script is included with DB2 to 'pull the rug'. On a UNIX environment:
This will bring down DB2 processes and clean up IPC resources. On the next connect to the database (assuming inflight transactions when the script was run), you should expect to see 'Crash Recovery' being initiated. This is just telling us that we are applying transactions that existed in the logs before the shutdown.
I strongly recommend this only be used in extreme situations. If its just to bring down DB2 to perform system maintenance, this is not the way to go... db2stop is still preferred.