I've never got this working the first time, but now I can't seem to do i at all.
There is a connection pool somewhere using the database, so trying to drop the database when an application is using the database should give this error. The problem is there are no connection to the database when I issue these commands:
db2 connect to mydatabase
db2 quiesce database immediate force connections
db2 connect reset
db2 drop database mydatabase
This allways give:
SQL1035N The database is currently in use. SQLSTATE=57019
running this command shows no connections/applications
DB2 list applications
I can even deactivate the database, but still can't drop it.
db2 => deactivate database mydatabase
DB20000I The DEACTIVATE DATABASE command completed successfully.
db2 => drop database mydatabase
SQL1035N The database is currently in use. SQLSTATE=57019
db2 =>
Anyone got any clues? I'm running the cmd-windows as the local administrator (windows 2008) and this is also the admin for DB2. The connectionpool-user cannot connect during quiesce-state.
Just as a tip if Arun's tip does not work, because an remote app is instantly reconnecting to the db.
Not sure if the
db2 force
and thedb2 terminate
is necessary, though. It's just our best practice.I just use 'db2stop force', then 'db2start' , then drop db. This way is better than quiesce command which is asynchronous by nature.
Your problem might occur because of the differences of
connect reset
andterminate
. Have a look at this discussion. You can also have a look at the IBM documentation. So it might work for you if you run adb2 terminate instead
of adb2 connect reset
.The quiesce will prevent the drop from working. We were involved in a large cleanup effort and after running revoke/connect and quiescing the databases we waited a few months to drop the test dbs. Our drop command wouldn't work unless we unquiesced the db then dropped.
Do these steps from command line. This will drop the db:
Force applications all;
deactivate db ;
drop db ;
When a db is quiesced it is still on the chain of databases with the db manager, albeit marked as quiesced. When you try to drop it, we will check to see if it is on this chain; if so, then it is still in use ==> You cant drop it.
You have to issue an unquiesce db or issue a db2stop and db2start and then try to drop it. It should work.
I have similar problem but no matter how I force application to stop, it will automatically come back.
In my case, it's a Service that's locking the database.
I was able to solve this by terminate PID service from Windows Task Manager with PID found in DB2 Application List.
To find PID, open to DB2 Control Center, All Databases, DATABASE (the one you are trying to drop), Application List, Show Lock Chain, Show Lock Details and scroll down to find Client Process ID and terminate this PID and try again.
Hope this helps people in the future.