Sunday, December 19, 2010

How to recover DB2 Database using RESTORE command

When DB2 Database get corrupted, you can use in-built RESTORE utility of db2 database to recover your database.

The RESTORE DATABASE command helps to rebuild a damaged or corrupted DB2 database that has been backed up using the DB2 backup utility.

Backup are of 2 types as I explained in earlier article. Now here I am going to explain how to use Restore command to recover your corrupt DB2 database.

Note: The restored database should be in the same state that it was in when the backup copy was made.

For Online & Offline backup we used different Restore commands.

The following command performs an offline restore that requires exclusive access to the entire database:

db2 => restore database backdem user db2admin using db2admin from
C:\dbback taken at 20031026195337 without rolling forward

In the following online restoration syntax, exclusive access is required only for the tablespace: tablespace1:

db2 => restore database backdem tablespace (tablespace1) online from
c:\dbback taken at 20031026195337 without rolling forward

This command only helps when either you have online backup or offline backup. In some cases we have updated backup but we can not recover our database through this command. In such cases we can use db2 recovery software to recover our corrupt DB2 database. These software are very easy to use & recover our corrupt database in most causes of corruption.

No comments:

Post a Comment