INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Database Backup/Restore

RECOVERY OF ACCIDENTALLY DROPPED TABLES by sathyarams
Posted: 30 Dec 02



1. Setup the database for Table recovery

1)    The archival logging should be tuned on.

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.


Back to IBM: DB2 FAQ Index
Back to IBM: DB2 Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close