Today, we will focus on the actual operation code for DB2 to restore tables accidentally deleted, if you are interested in the actual operation code for restoring the accidentally deleted table in DB2, you can click the following article to view it. The following is the description of the actual operation code segment, I hope you will have a better understanding of it after browsing.
Delete
A test was conducted to restore the accidentally deleted table. The specific process is as follows:
- DB2 ALTER TABLESPACE USERSPACE2 DROPPED TABLE RECOVERY ON
- DB2 "list history dropped table all for cdbiold"
- DB2 backup db cdbiold to /databk with 2 buffers buffer 512
- DB2 "delete from DC_BILL_STATUS where count_time='20080731'"
- DB2 drop table DC_BILL_STATUS
- DB2 "select TBSPACE,DROP_RECOVERY from syscat.tablespaces where owner='DB2ADMIN'"
- DB2 "list history dropped table all for cdbiold"
- Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID
- D T 20090317165133 000000000039210b00020006
- "DB2ADMIN"."DC_BILL_STATUS" resides in 1 tablespace(s):
- 00001 USERSPACE1
- Comment: DROP TABLE
- Start Time: 20090317165133
- End Time: 20090317165133
- Status: A
- EID: 39
- DDL: CREATE TABLE "DB2ADMIN"."DC_BILL_STATUS" ( "COUNT_TIME" VARCHAR(8) NOT NULL ,
- "ORG_CODE" VARCHAR(8) NOT NULL , "BILL_TYPE" VARCHAR(40) NOT NULL , "FLAG" CHAR(1) NOT NULL WITH DEFAULT 'N' ,
- "OPER" VARCHAR(64) NOT NULL WITH DEFAULT ' ' , "UP_FLAG" CHAR(1) NOT NULL WITH DEFAULT 'N' ) IN "USERSPACE1" ;
- DB2 force applications all
- DB2 restore db cdbiold from /databk taken at 20090317
- DB2 rollforward db cdbiold to end of logs and stop recover dropped table 000000000039210b00020006 to /databk
- DB2 "select count(*) from DC_BILL_STATUS where count_time='20080731'"
- 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.