If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Issue dropping database when raw datafiles deleted

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-04-05, 00:01
misnoma misnoma is offline
Registered User
 
Join Date: Mar 2005
Posts: 4
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
Reply With Quote
  #2 (permalink)  
Old 03-04-05, 01:09
jacampbell jacampbell is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 03-04-05, 01:13
misnoma misnoma is offline
Registered User
 
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 :/
Reply With Quote
  #4 (permalink)  
Old 03-06-05, 15:38
misnoma misnoma is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 12-12-05, 13:27
henrygreijer henrygreijer is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 12-12-05, 14:16
misnoma misnoma is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On