cancel
Showing results for 
Search instead for 
Did you mean: 

Restore deleted records in a specific table

Former Member
0 Kudos

Hi,

We are running db2 udb 9.5 wiht fixpack 2a and SP_BASIS 700 level 0020.

All records created before a certain date were deleted by mistake. We can get those records back from backups but how do we append those records?

Are there any tool i SAP for this, in in that case what format should the file with the records have?

or

Can we just append the records using db2 command line?

Accepted Solutions (0)

Answers (1)

Answers (1)

Frank-Martin
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Tomas,

did you delete records from one table only? If this is the case it should be possible to use DB2 EXPORT/IMPORT to restore the data from a restored backup to your productive database.

Before running the DB2 EXPORT and IMPORT utilities, you need to make sure that the correct codepage is set in your environment. Otherwise DB2 may perform unwanted codepage conversions. You can prevent codepage conversions by setting DB2CODEPAGE in your environment.

setenv DB2CODEPAGE 1208 on a unicode system

setenv DB2CODEPAGE 819 on a non-unicode system

The export command on your restored database looks like:

db2 "export to TAB.IXF of IXF select * from schema.table where timestamp < xxx "

The import command on your productive database looks like:

db2 "import from TAB.IXF of IXF insert into schema.table "

If the table contains LONG or LOB columns, the commands may become more complicated. You should use IXF format since the table may contain binary data.

Regards

Frank