Example code used to restore a table accidentally deleted by DB2

Source: Internet
Author: User

This article mainly describes the correct operation steps for restoring a table accidentally deleted by DB2. If you are interested in the correct operation steps for restoring a table accidentally deleted by DB2, the following articles will unveil its mysteries. I hope you will gain some benefits after browsing.

A test was conducted to restore the accidentally deleted table. The specific process is as follows:

 
 
  1. DB2 ALTER TABLESPACE USERSPACE2 DROPPED TABLE RECOVERY ON  
  2. DB2 "list history dropped table all for cdbiold"  
  3. DB2 backup db cdbiold to /databk with 2 buffers buffer 512  
  4. DB2 "delete from DC_BILL_STATUS where count_time='20080731'"  
  5. DB2 drop table DC_BILL_STATUS  
  6. DB2 "select TBSPACE,DROP_RECOVERY from syscat.tablespaces where owner='DB2ADMIN'"  
  7. DB2 "list history dropped table all for cdbiold"  
  8. Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID  
  9. D T 20090317165133 000000000039210b00020006   
  10. "DB2ADMIN"."DC_BILL_STATUS" resides in 1 tablespace(s):  
  11. 00001 USERSPACE1   
  12. Comment: DROP TABLE   
  13. Start Time: 20090317165133  
  14. End Time: 20090317165133  
  15. Status: A  
  16. EID: 39  
  17. DDL: CREATE TABLE "DB2ADMIN"."DC_BILL_STATUS" ( "COUNT_TIME" VARCHAR(8) NOT NULL ,   
  18. "ORG_CODE" VARCHAR(8) NOT NULL , "BILL_TYPE" VARCHAR(40) NOT NULL , "FLAG" CHAR(1)   
  19. NOT NULL WITH DEFAULT 'N' , "OPER" VARCHAR(64) NOT NULL WITH DEFAULT ' ' , "UP_FLAG" CHAR(1) NOT NULL WITH DEFAULT 'N' ) IN "USERSPACE1" ;   
  20. DB2 force applications all   
  21. DB2 restore db cdbiold from /databk taken at 20090317  
  22. DB2 rollforward db cdbiold to end of logs and stop recover dropped table 000000000039210b00020006 to /databk   
  23. DB2 "select count(*) from DC_BILL_STATUS where count_time='20080731'"  
  24. DB2 import from /databk/NODE0000/data of del insert into DC_BILL_STATUS   

The above content is an introduction to the accidental deletion of tables in DB2 recovery. I hope you will find some gains.

The above content is the description of the table accidentally deleted after DB2 recovery, and we hope to provide you with some help 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.