How to restore a table deleted from DB2

Source: Internet
Author: User

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"
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.