DB2 Basics: Backups of Data and Recovery

By | August 1, 2015

DB2 database backupWhy we need Backup?

Keeping backup of any DBAs is very important. It should be one of the first and last things that we must do correctly. We should keep backup so that we can restore data back if there is any unexpected situations comes in such as hardware or software failure, human errors, etc. And hence we must keep backups of any data including DB2 database file. Regular backups are sued to transfer data from one server to another.

What is DB2’s Backups?

The particular files that are called backups by DB2 are actually binary files that display every bit of data in a DB2 database. They are very big in sizes. Because they are at bit level and hence it cannot be restored between different operating systems because it uses different characters for display. Restores are not possible between big-endian Linux/UNIX and little-endian Linux/Unix and it is also not possible between Windows and Linux/Unix because they are not compatible.

What are the backup options?

Well, there are various options for creating backup. Here are some options mentioned below:

Online and Offline

You can create backup online as well offline. If you opt for offline database backup, then nobody can access the database while the backup is taken, and you must stop all connection and disable the database before the backup is created.

You must also consider if your database is also enabled for online backups. The databases that use archive logs only that specific database are allowed for online backups. If the databases use the default of circular logging then you can’t take online backup.

Types of Backup

The types of backup that can be created are mentioned below:

  • Full – all database is backed up.
  • Incremental – changes the data since the last full backup are backed up.
  • Delta – changes the data since the last full or incremental backup are backed up.

We, suggest you must always go for full backup whenever possible. Well, you can also go for incremental backups to save times because full backups take more time.

Compress the Backup

While creating backup, you can command DB2 optionally to compress the backup. It is a very good option if you are creating the backups to disk. If you are taking backup to the location that applies self compression then you can avoid this compression commands when the backup is taken. In order to compress the backup just use the COMPRESS keyword from the BACKUP DATABASE command. Well, you can also compress the data after the backup by using software that compresses the file. It will reduce the time and also it will occupy less space.

What if DB2 database backup is not available?

If you have not created any backup and if there is any unexpected situations comes in such as hardware or software failure, human errors, DB2 corruption etc. The in such situations you can use DB2 file repair tool to repair and recover your entire DB2 database. With the help of this tool you can restore every elements of DB2 database. It comes with advanced algorithm that scans the DB2 database and recovers the entire database.

downloadnow buynow learn-more-button-orange

Steps to recover DB2 database file if backup is not available

Step 1: Install and Run DB2 File Repair tool. It will provides two options to repair db2 file, first option is for if the database is attached to DB2, then you can select the option ‘Repair the database stored at default location‘, and if the database is not attached to DB2 then choose the manual selection of database.

1 (3)

Step 2: It will provide you the list of database attached to DB2. Select the particular database you want to repair and recover corresponding database objects.

2 (2)

Step 3: In this step this tool provide the list of recoverable database files. You can see the preview by clicking on it.

3 (2)

Step 4: Give the path location for the recoverable database and its object to be saved. Click on ‘Ok’ button.

4 (2)