Db2 database alias not listed via list database directory but still unable to create that database

catalogsdb2linux

I am trying to create a database by logging on to the linux server on which the db2 server is installed, as the instance owner

db2 => list database directory

 System Database Directory

 Number of entries in the directory = 1

Database 1 entry:

 Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Local database directory             = /home/mylogin/sqllib
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

db2 => create database testdb2
SQL1005N  The database alias "TESTDB2" already exists in either the local 
database directory or system database directory.
    db2 => list database directory on /home/mylogin/sqllib

 Local Database Directory on /home/mylogin/sqllib

 Number of entries in the directory = 1

Database 1 entry:

 Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Database directory                   = SQL00001
 Database release level               = f.00
 Comment                              =
 Directory entry type                 = Home
 Catalog database partition number    = 0
 Database member number               = 0
db2 => quit

I also checked if there are any other instances that exist other than mine, but there aren't.

DB20000I  The QUIT command completed successfully.
-bash-4.1$ db2ilist
mylogin

While the alias testdb2 is not listed by list database directory , db2 claims that this alias already exists in either the system database directory or the local database directory.

If this is true, how do I get the equivalent of list database directory that lists testdb2 as well?

Best Answer

db2 list db directory is for the system level directory. There is also db2 list db directory on <path> which lists any databases on that particular path.

Wondering if you have tried to uncatalog or catalog it first? You could see if cataloging it allows you to drop it.

Worse case you may need to locate the spot on disk with the database and remove it manually (as long as it isn't cataloged).