Monday, December 13, 2010

How to recover corrupted DB2 database by using backup

You can take two types of backup to recover corrupted DB2 Database ie : Offline & Online.

How to take offline backup:

DB2 Database does not take backup of physical files that make up your tablespaces and database. It goes directly into those objects and back up the data and index pages directly. This gives DB2 a lot more flexibility when it comes time to do a restore.

To backup your db2 database use this backup command:

"DB2 BACKUP DATABASE db_name TO device_or_directory"

That is the simplest form which will back up all the tablespaces in the database named db_name to the directory or the device.

You don't have to backup the full database. You can backup a set of tablespaces or you can also backup a single tablespace.

When use tablespace level backups:

In order to perform tablespace level restores do not use tablespace level backups. Use tablespace backups only if you dont have enough time or space to do a full database backup.

To do tablespace level backups simply add this command:

TABLESPACE ( tablespace_name, tablespace_name)

to the above backup command. Write those
tablespace(s) inside the parenthesis that you want to backup and DB2 will only backup those objects.

How to take online backup:

To perform an online backup add “ONLINE” to the above backup command. Before taking online backup you have to remember that you must be archiving your log files. You cannot use circular logging.

So you can recover your corrupted DB2 Database by using offline backup or Online backup. It can only happen if you maintain your backup:Offline or Online.

But in case of no backup than go for third party DB2 Recovery tools. These tools are very easy to use just download its demo version & try these tools to recover your corrupted DB2 Database in most possible causes of corruption.

No comments:

Post a Comment