If you want to restore and delete a table while using the DB2 database. What should I do? This document describes how to restore a table in DB2 for your reference.
Here we reprinted an operation to restore the table after the drop operation, similar to the flash back in oracle 10g.
DB2 stores backup, recovery, data loading, and table deletion operations in historical files.
Assume that the database name is sample. You can use the following command to list the records for deleting a table: db2 "list history dropped table all for sample"
The next step is to restore the tablespace where the table is located from the previous backup. The backup directory is c: db2backup.
Without rolling forward indicates that rollback is not required.
Db2 "restore db sample tablespace (userspace1) from c: db2backup taken at 20041102100931 without rolling forward without prompting"
Step 3: unmount the data in the deleted table to a directory.
Db2 "rollforward db sample to end of logs and complete recover dropped table partition 00000000000002010002000d to c: db2backup"
Step 4: Use the DDL statement of the table retained in the history file to recreate the table.
Step 5: Reload the data to the table. p () indicates the content of the first and second fields of the table to be loaded. recoverme is the table name.
Db2 "load from c: db2backupnode1_data of del method p (1, 2) insert into recoverme"