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 > How do I recover after accidentally deleting SMS tablespace containers?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-10-04, 07:18
marcushaas marcushaas is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
Unhappy How do I recover after accidentally deleting SMS tablespace containers?

Does anyone know how to rebuild a database when SMS tablespace containers have been deleted while the database was shut down?

I inadvertently deleted (using rm *, yes really) about 48 large files which were the tablespace containers for one of the schemas in a database I (mis-)manage (DB2 v7.2 under AIX v4.3). I realised what I'd done (I was in the wrong directory) and stopped the rm, so a further 12 containers have survived.

My initial reaction was to see if the files could be recovered, since the database manager was not running and no other user has access to the filesystem in question, hence the data blocks would have remained undisturbed.

Unfortunately, though the data still exists, the pointers which would enable the disk blocks to be joined up again in the correct sequence were nulled by the rm command.

I don't want to recover from the last backup, because it is quite old and would entail reprocessing 13 generations of archived feed data which would take some time (at least a week).

The design of the database is such that most of the data in the missing containers is replicated in another schema, so what I'd like to do is recreate the missing containers, get the database running again, and repopulate the tables from tables in the other schema. The data which isn't replicated I hope to recover by means of a partial restore from the last full backup, reprocessing only a small subset of the archived feed data.

This begs several questions:

I understand that when I attempt to activate the database, it will complain it is damaged, so I do I get past that point?

Is there anything I need to do before that point?

Once past that point, what do I need to do?

How do I find out which file corresponded to which tablespace, or do I only need the list of filenames which are missing, or do I not actually need to know any of this?

Will I need to recreate all the tables (the DDL is all archived)? I would have thought not, since the definitions must still be in the system catalog which is elsewhere.

I really hope someone can help...
Reply With Quote
  #2 (permalink)  
Old 12-10-04, 09:46
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Do you have LOGRETAIN on? Your 100% best option is to RESTORE and roll forward through the logs if you have them... you should be able to get to the current point in time, assuming you don't have any unrecoverable loads or not logged LOBs.

You won't be able to do much with the database now, I don't think it will let you even connect.

You might be able to use "db2dart" to dump the non-deleted data to files, then import it into a new database.
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #3 (permalink)  
Old 12-13-04, 13:17
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
As Jonathan suggests, restoring and rolling forward is the best solution ...

Alternatively, if you have a recent file backup of the deleted files, you may try restoring it and activating the database ... Once you activate, you may load the missing data from the other database ...

If you have created any new tables in the SMS Tablespaces and one of those files have been deleted, it may become difficult

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
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