Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013
    Posts
    31

    Unanswered: Database won't drop... suggestions?

    I've ran into this before, but for some reason nothing i'm doing will work. I had a database I restored to E:, but now I dropped it and need to restore it again though DB2 still thinks it's there. This is on DB2 9.5 LUW on Windows Server 2003.

    Here's what I'm seeing:

    >db2 list db directory on C:

    Local Database Directory on C:

    Number of entries in the directory = 3

    Database 1 entry:

    Database alias = TOOLSDB
    Database name = TOOLSDB
    Database directory = SQL00001
    Database release level = c.00
    Comment =
    Directory entry type = Home
    Catalog database partition number = 0
    Database partition number = 0

    Database 2 entry:

    Database alias = TARGETDB
    Database name = TARGETDB
    Database directory = SQL00002
    Database release level = c.00
    Comment =
    Directory entry type = Home
    Catalog database partition number = 0
    Database partition number = 0

    Database 3 entry:

    Database alias = TESTDB1
    Database name = TESTDB1
    Database directory = SQL00003
    Database release level = c.00
    Comment =
    Directory entry type = Home
    Catalog database partition number = 0
    Database partition number = 0

    The TESTDB1 database only shows-up when I catalog on C:, so I try to recatalog it on C:

    >db2 catalog db TESTDB1 on C:
    DB20000I The CATALOG DATABASE command completed successfully.
    DB21056W Directory changes may not be effective until the directory cache is refreshed.

    Then try to drop it again.

    >db2 uncatalog db TESTDB1
    DB20000I The UNCATALOG DATABASE command completed successfully.
    DB21056W Directory changes may not be effective until the directory cache is refreshed.

    Then I delete the directory C:\DB2\NODE0000\SQL00003... but I'm still unable to restore the database and listing the Database Dir on C: still shows TESTDB1 on directory SQL00003. I'm totally at a loss on how to remove this database reference from the server. I've even searched the entire server for another folder named SQL00003 but nothing is there. Heck I even stopped and restarted DB2 but still nothing.

    Thanks for any advise.

    Sam

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Uncatalog != drop.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Sam,

    You should never erase any db2 subdirectory structure manually unless you are sure that there is no corresponding entry in a local database directory.
    When you create a database the corresponding entry is placed into both local and system database directory.
    When you uncatalog (not drop) the database the corresponding entry is removed only from the system db directory but not from the local one. This is why you still see your db in the 'list db directory on c:' command.

    Now you have an 'inconsisted' situation: there is the entry in the local db directory but you have erased the corresponding subdirectory structure: C:\DB2\NODE0000\SQL00003

    Since IBM doesn't provide any way to manually edit a local db directory, you will always have this TESTDB1 entry there. Actually you can try to recreate this directory above and issue 'drop db testdb1' (which automatically removes the corrresponding entry from the local db directory) but as far as I remember it can return an error complaining on some inconsistency in the subdirectory structure...
    Regards,
    Mark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •