DROP DATABASE fails
Asked Answered
B

2

8

I have a DB2 database (let's call it mydb) that I would like to delete. However, when I do db2 drop db mydb I get back

SQL1035N The operation failed because the specified database cannot be connected to in the mode requested. SQLSTATE=57019

What am I doing wrong?

Brahear answered 29/6, 2016 at 9:50 Comment(2)
ibm.com/support/knowledgecenter/SSEPGG_9.8.0/… here some steps for troubleshootingLament
It's probably in use by some applications.Spondylitis
M
11

You should try the following:

db2 quiesce db immediate
db2 force application all
db2 drop database mydb

'Quiesce' forces all users off the specified instance and database and puts it into a quiesced mode. (https://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0008635.html)

'Force application' forces local or remote users or applications off the system to allow for maintenance on a server. (https://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001951.html)

If that doesn't do the trick, do 'db2stop' and 'db2start' after the 'force application' and then drop the database

Manganese answered 6/7, 2016 at 9:15 Comment(1)
After all that. When I tried to create the sample database using db2sampl command, it gave me the following error: DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL1024N A database connection does not exist. SQLSTATE=08003Broadax
B
1

You can try:

db2 terminate

then run the command:

db2sampl
Broadax answered 12/2, 2018 at 4:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.