DB2 database directory shows DB that does not exist

11,228

Solution 1

It would seem your local catalog is out of sync.

You may want to try UNCATALOG DATABASE TEST_AN, which will manually remove the database registration from the local catalog.

Solution 2

for what its worth I couldn't drop a database no matter what I tried, then I figured out that if I recatalog it I could drop it.

so running

CATALOG DBNAME
DROP DB DBNAME

worked for me

Share:
11,228
Andrew Niefer
Author by

Andrew Niefer

Updated on June 13, 2022

Comments

  • Andrew Niefer
    Andrew Niefer almost 2 years

    I have an old test database showing when I run db2 list database directory

    Database 8 entry:
    
     Database alias                       = TEST_AN
     Database name                        = TEST_AN
     Local database directory             = /home/users/db2inst
     Database release level               = d.00
     Comment                              =
     Directory entry type                 = Indirect
     Catalog database partition number    = 0
     Alternate server hostname            =
     Alternate server port number         =
    

    But it is not there when I run db2 list database directory on /home/users/db2inst

    I can't connect to it:

    > db2 connect to TEST_AN
    SQL1013N  The database alias name or database name "TEST_AN" could not be 
    found.  SQLSTATE=42705
    

    or drop it:

    > db2 drop db TEST_AN
    SQL1013N  The database alias name or database name "TEST_AN  " could not be 
    found.  SQLSTATE=42705
    

    And I can't create a new DB using that name:

    > db2 create database TEST_AN
    SQL1005N  The database alias "TEST_AN" already exists in either the local 
    database directory or system database directory.
    

    Does anyone know what the problem is, how can I get rid of this db that does and does not exist?