0

On db2 LUW LInux: Is there a possibility to recreate tablespace somewhere aside pointing to a different tablespace name created only for the purpose of unloading data from the table. I'd like to be able to extract data or restore data from a damaged table so that you don't have to recreate the entire database, which usually takes a lot of disk space and time

bartezzzz
  • 1
  • 1

1 Answers1

0

You can't do it back into the original db, but you could create a separate db that contains just the tablespace with the data you're interested in:

db2 restore db foo rebuild with tablespace ( syscatspace, mytbsp )
db2 rollforward db foo to end of logs and stop
db2 export to mytable.del of del select * from mytable 
  • (The implication here is that you're doing it on a different system -- you won't want to restore into your actual prod database. You could also do a RESTORE FOO INTO BAR but that's a bit more complicated.) – David Mooney Nov 22 '22 at 15:32
  • Thank you for this information. I have already restored few tablespaces into separate database on the same server and everything worked fine. However, we have to remember to transform system tablesspaces for automatic storage – bartezzzz Dec 19 '22 at 11:00