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 > recover table if dropped by mistake

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-03-09, 19:23
db2zip db2zip is offline
Registered User
 
Join Date: Apr 2009
Posts: 42
recover table if dropped by mistake

Hello,

If my table is dropped by mistake - how to recover it? Can I recover this table from tablespace backup? Can I recover this table if I don't have any backup?

Thank you.
Reply With Quote
  #2 (permalink)  
Old 08-03-09, 21:51
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
If you don't have a backup, I can't see how you could recover.

If you do have a backup, you should be able to recover. If nothing else, you could recover the database someplace and used DDL to recreate the object and move the data to the newly recreated table.

Not that this helps you now, but there is a parameter when you create a table that restricts dropping the table until you alter the table to remove this restriction. This would prevent accidental drops in the future.
Reply With Quote
  #3 (permalink)  
Old 08-04-09, 01:18
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
which version ?
Quote:
Originally Posted by Stealth_DBA
If you don't have a backup, I can't see how you could recover.

If you do have a backup, you should be able to recover. If nothing else, you could recover the database someplace and used DDL to recreate the object and move the data to the newly recreated table.

DB2 Database for Linux, UNIX, and Windows

Not that this helps you now, but there is a parameter when you create a table that restricts dropping the table until you alter the table to remove this restriction. This would prevent accidental drops in the future.

alter table ....... restrict on drop
__________________
Rahul Singh
Certified DB2 9 DBA / Application Developer
Reply With Quote
  #4 (permalink)  
Old 08-04-09, 06:53
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You can recover the table if you had the drop-table-recovery feature activated on the tablespace. (That's DB2 LUW.)
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 08-04-09, 08:23
db2zip db2zip is offline
Registered User
 
Join Date: Apr 2009
Posts: 42
Thank you. Can I recover my table using tablespace backup if drop-table-recovery feature is not activated on the tablespace?
Reply With Quote
  #6 (permalink)  
Old 08-04-09, 11:39
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
You have to restore the db and rollforward to a point prior to the drop table operation. DB2 will force you to rollforward to at least the minimum recovery time after restoring the tablespace and this minimum recovery time will be the time of the last DDL performed against any object in the tablespace.
Reply With Quote
  #7 (permalink)  
Old 08-04-09, 11:41
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
This applies to cases where the drop table recovery option is not enabled.
Reply With Quote
  #8 (permalink)  
Old 08-04-09, 11:52
db2zip db2zip is offline
Registered User
 
Join Date: Apr 2009
Posts: 42
Thank you. Is this process different on DB2 z/OS?
Reply With Quote
  #9 (permalink)  
Old 08-04-09, 12:12
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
I haven't used mainframe for a while... From what I remember, you can recover if you have a full image copy of your tablespace. I also remember recovering a dropped table when the image copy was not available. If the original vsam dataset still exists and the obid of the table has not been reused (??), you can use dsn1copy to copy the data from the vsam dataset to a flat file and then use this file to load the table (assuming you have the DDL to recreate the table). Please don't rely on this info since this may not be accurate and there are might be other options available in newer versions. It's better to wait for mainframe people to answer your z/OS recovery question.
Reply With Quote
  #10 (permalink)  
Old 08-04-09, 12:50
rdutton rdutton is offline
Registered User
 
Join Date: Dec 2008
Posts: 76
Utilities act at the tablespace level on the mainframe. If you have 1 table defined per tablespace (not unusual on MF) you can use DSN1COPY to directly recover the tablespace. Otherwise, it gets complicated. Of course, this assumes you have an imagecopy (backup) of the tablespace.
__________________
RD
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