How to restore and delete a table in DB2

Source: Internet
Author: User

The following articles describe how to restore and Delete tables in DB2. In actual operations, the DB2 database stores backups and restores data in historical files, and operations such as loading data and deleting tables. if the database name is sample, you can use the following command to list the records of the table to be deleted:

 
 
  1. 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, indicating that the rollback is not required.

 
 
  1. 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.

 
 
  1. db2 "rollforward db sample to end of logs and complete recover dropped table 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.

 
 
  1. db2 "load from c:\db2backup\node0000\data OF DEL METHOD p(1,2) insert into recoverme" 

The above content is an introduction to the DB2 table restoration and deletion technique. I hope you will get some benefits.

The above content is a description of the DB2 table restoration and deletion technique, hoping to help you in this regard.

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.