Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    4

    Unanswered: Issue dropping database when raw datafiles deleted

    So.. I was testing a cleanup script this afternoon... and lo and behold, as such things do at 4:30pm on a Friday, it went wild, and managed to hose a lot of the contents of my C:\DB2 directory (yes, I'm an idiot )

    This is DB2 UDB 8.2 on Windows 2000 by the way.

    Anyhow.. for two of the three databases (it's only a dev server), I managed to drop the databases, and restore the backups I had just fine. However for the TOOLSDB database, the whole directory under C:\DB2 had been removed, so db2 thinks the database exists, however will error if you try and DROP DATABASE on it because it can't find the files to remove - sigh.

    I've searched here and on google, but can't find any way to tell db2 to just forget that it ever had that database, ignoring the lack of files so I can restore the backup that I have.

    Any help would be gladly appreciated.. I'm guessing there's a way to do this, I'm just not cluefull enough to work it out it seems

  2. #2
    Join Date
    Jan 2005
    Posts
    191
    Somewhere in the back of my mind there is a memory of using UNCATALOG DATABASE to clean up a situation like this - but it's very fuzzy (the memory, that is).

    James Campbell

  3. #3
    Join Date
    Mar 2005
    Posts
    4
    Yeah, sorry I should have mentioned I have tried that, and it'll happily uncatalog and catalog the corrupt (missing!) database over and over.. It seems to go with that you need to DROP DATABASE it, and that's the bit that's behaving nastily :/

  4. #4
    Join Date
    Mar 2005
    Posts
    4
    Just an update on this - I found a solution and thought I would share it incase anyone else hits this.

    All I did in the end, was recreated the directory C:\DB2\NODE0000\SQL00001 (which was the raw datadir for the database I was trying to drop), then reran the DROP DATABASE command, and db2 stopped complaining.. seems that's as much as it checks for.

    After that it was an easy case of restoring the latest backup I had and everything was happy.

  5. #5
    Join Date
    Dec 2005
    Posts
    2
    Quote Originally Posted by misnoma
    Just an update on this - I found a solution and thought I would share it incase anyone else hits this.

    All I did in the end, was recreated the directory C:\DB2\NODE0000\SQL00001 (which was the raw datadir for the database I was trying to drop), then reran the DROP DATABASE command, and db2 stopped complaining.. seems that's as much as it checks for.

    After that it was an easy case of restoring the latest backup I had and everything was happy.
    One hundreds of millions and thousands of thanks to you misnoma !!!!
    You just saved the day, I had exactly the same problem...

    DB2 Experts: What is the correct way of removing a database really ?

    /Henry, Sweden

  6. #6
    Join Date
    Mar 2005
    Posts
    4
    The correct way is to issue a DROP DATABASE xxxxxx command, just don't remove the raw datafiles first

Posting Permissions

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