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