Thursday, July 7, 2011

db2 merge backup - utility test

I was very excited about "db2 merge backup" tool. As per the documentation this tool is supposed to merge incremental and delta backup and merge it with the most recent full db backup prior to these incremetnal or delta backups. More details about this utility can be found here

So, if you have this tool working you take one full backup and there are after you just do delta backups and keep merging them with you full backup. Here after you never take full db backups again.

Out of excitement I decided to test this tool. Downloaded this tool and set it up on my window workstation. I did my full backup, ran couple of database transactions and took the delta backup. Below is the control file options and the command used and the output as well.

Below are the contents from "SampleMergeCtrlFile.txt" control file used in the test. I used the control file examples from the following link here

MERGE DATABASE ZZZ
PART (0)
START FROM "C:" TAKEN AT 20110707153755
END FROM "C:" TAKEN AT 20110707154108
OUTPUT TO "C:\Merged\"

Below is the my db2 merge command output.

db2mbk -i DB2INST1 -f SampleMergeCtrlFile.txt -s -p 0
MBKI445W Warning: you are still using a temporary license.
         you need to enroll DB2 Merge Backup for Linux, UNIX, and Windows within 29 days.
MBKM031I DB2 Merge Backup for Linux, UNIX, and Windows 01.01.000(110505) 32 bits 7/7/2011 (Windows)
       ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----10----+----11----+----12----+----13--
000001 MERGE DATABASE ZZZ
PART (0)
START FROM "C:" TAKEN AT 20110707153755
END FROM "C:" TAKEN AT 20110707154108
OUTPUT TO "C:\Merged\"
MBKB005I MBK control step start   : 16:00:40.287.
MBKB037I Merged backups will not be registered into DB2.
MBKB005I [0] MBK control step start   : 16:00:40.302.
MBKB006I [0] MBK control step end     : 16:00:40.318.
MBKB006I MBK control step end     : 16:00:40.318.
MBKB053I MBK run step start       : 16:00:40.318.
MBKB007I [0] MBK inventory step start : 16:00:40.318.
MBKB021I [0] The partition 0 backup image taken at 20110707154108 is involved in the merge (type INCREMENTAL ONLINE DATABASE, device DISK)
MBKB008I [0] MBK inventory step end   : 16:00:40.349.
MBKB009I [0] MBK merge step start     : 16:00:40.349.
MBKB028I [0] The utility will build the partition 0 backup image taken at 20110707154109 (type FULL ONLINE DATABASE, device DISK)
MBKB021I [0] The partition 0 backup image taken at 20110707153755 is involved in the merge (type FULL ONLINE DATABASE, device DISK)
MBKB010I [0] MBK merge step end       : 16:00:41.849.
MBKB054I MBK run step end         : 16:00:41.849.
MBKI442I MBK successfully ended: real time -> 0m1.562530s


As per the output the merge was successfull. Then I attempted to restore above merged backup set to a new database. Remember merged backup image is equivalent to full backup. The attempted restore failed and db2 complained that the backup image is corrupt!!

db2 restore db zzz from C:\ taken at 20110707154109 into zzz_tmp
SQL2529W  Warning!  Restoring to an existing database that is different from
the backup image database, and the alias name "ZZZ_TMP" of the existing
database does not match the alias name "ZZZ" of the backup image, and the
database name "ZZZ_TMP" of the existing database does not match the database
name "ZZZ" of the backup image. The target database will be overwritten by the
backup version. The Roll-forward recovery logs associated with the target
database will be deleted.
Do you want to continue ? (y/n) y
SQL2530N  The backup image is corrupted.  Restore of database from this backup
image is not possible.

I felt may be my original backups (full and delta) are corrupt. I restored those backups sets instead of the merged and they work just fine. This concluded that the db2 merge utility is doing something funky.

If you find my test is not appropriate, correct me by leaving a comments.

Update: I was testing this on db2 express 9.7.0 on Window XP. Looks like this issue got resolved after I upgraded db2 to FP4. Later I also fond that if you don't want to upgrade db2 you can modify the merge utility configutaion with following file entry "vendor_object = no" in the configuration file located at "DB2TOOLS\MergeBackup11\cfg\db2mbk.cfg"

No comments:

About Me

By profession I am a Database Administrator (DBA) with total 13 yrs. of experience in the field of Information Technology, out of that 9 yrs as SQL DBA and last 3 years in IBM System i/iSeries and DB2 LUW 9. I have handled Developer, plus production support roles, and I like both the roles. I love and live information technology hence the name "Techonologyyogi" Apart from that I am a small, retail investor, with small investments in India and United States in the form of Equity holdings via common stocks. Don't ask me if I have made money, I have been loosing money in stocks.