2) The tablespace should be created with DROPPED TABLE RECOVERY ON.
If this was not done during creation of the tablespace it can be done with ALTER TABLESPACE Statement.
ALTER TABLESPACE <tablespace-name> DROPPED TABLE RECOVERY ON
2. Procedure
To recover an accidentally dropped table:
1) List the history file to get information about the dropped table id and the DDL to create the table.
DB2 LIST HISTORY DROPPED TABLE <qualified table-name> FOR <database name>
From the listing get the backup id and the DDL for table creation.
2) Restore the database from the backup image available using the RESTORE backup command. This can be either database level restore or a tablespace level restore.
3) Rollforward the database/tablespace to end of logs or point in time using RECOVER DROPPED TABLE option.
ROLLFORWARD DATABASE <db-name> TO END OF LOGS AND COMPLETE RECOVER DROPPED TABLE <backup-id> to <path>
To a Point-in-Time can be used instead of TO END OF LOGS.
Backup-id is the one obtained from the list history command.
Path is where the file containing the rows of the dropped table is to be put.
4) Create the table by using the DDL in the output of the LIST HISTORY command
5) Import the data from the file named ædataÆ in æpathÆ
If more than one dropped table is the recovered the Rollforward process is to be repeated for each table. In this case, do not include æAND COMPLETEÆ option of the ROLLFORWARD command except for the last table.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.