In DB2 version v8 it is impossible to retrieve an entire database just from tablespace level backups, but in DB2 9 you can get back a complete database or even just a select part of a database from scratch entirely from tablespace level backup images.
You may also like: Fixing DB2 Database “Error: DB21034E the command was processed”
How it works
This restore set the database into a transformation stage. In this stage you can recover as many other tablespace images as you see correct. After recovering the tablespaces that you want, simply execute the rollfoward operation on the database to fetch it to a point of constancy. This step will open up all of the tablespaces that you have recovered and put them online for users to access.
If any of the tablespace that has not been recovered is place into a restore pending state. In this point you have three options, drop the tablespaces if they are no longer required, restore them at any time, roll them forward to a point of consistency, or simply leave them in restore pending state.
This new feature is packed with a number of implications. Implement it to create a test system with only those tablespaces you require for your tests.
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.
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.
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.
Step 3: In this step this tool provide the list of recoverable database files. You can see the preview by clicking on it.
Step 4: Give the path location for the recoverable database and its object to be saved. Click on ‘Ok’ button.