Sunday, October 25, 2015

Recovering damaged DB2 database by using backup



DB2 is a Relational DataBase Management System (RDBMS) originally developed by IBM. It is rich in features, provide great performance, capable of storing and maintaining large amount of data. But there are several unexpected things happen which may easily corrupt your DB2 database and you may face data loss. DB2 database gets corrupted by two ways physical and logical. However, if you have backup then you can easily restore your data from it. Anyway, here you will learn how to recover corrupted DB2 Database by using Backup.

Generally, you can go for two types of backup: Offline and Online.

So, How to go for offline backup:


While you create backup whether it is offline or online, you cannot create backup of physical file of DB2 Database. It directly indexes the pages and goes into those objects and backup the data. Hence, it provides more flexibility at the time of restoring.

To create backup simply use backup command:  

 DB2 BACKUP DATABASE db_name TO device_or_directory 

With this command you can easily backup entire tablespace in database named as db_name to directory or device. Well, you can backup full database or a set of tablespaces or a single tablespace, its totally depend on you. 

When to take tablespace level backups:


If you do not have time or enough memory to do full database backup you can then take tablespace backups, or else do not perform tablespace level stores.   

However, if you want to do tablespace level backups, just add below command:

 “ TABLESPACE ( tablespace_name, tablespace_name) “

How to take online backup:


If you want to take online backup then you have to just add only “ONLINE” to the above command for the backup. But please take a note, before you go for online backup you must archive the log files. Here, you can’t use circular logging. 


Well, you can also restore damaged or corrupted DB2 Database with the help of Offline and Online. You can restore it only when you have the backup.

What if you do not have backup?


However, if you do not have backup then you can use third party DB2 File Repair Tool. It is particularly designed to repair corrupted and damaged DB2 database and recover every single bit of objects. It is capable of repairing large size of database, detects the DB2 corruption automatically and fixes them. The tool is easy to use and user friendly.

0 comments:

Post a Comment