4

I have been searching a lot in the past couple of weeks on how to merge two whatsapp backup. Last month I got a new phone, installed whatsapp along with my old backup. During installation, whatsapp said, "backup found" and an option to restore. I clicked on it, it was processing for a very long time and then said backup cannot be restored :(

I started using whatsapp on this new phone and observed that the present database type is Crypt8 and my old database was of Crypt7 type (may be that it why the messages were not restored). I have still kept my old backup. Can anyone please tell me how can I merge these two databases (old Crypt7 and new Crypt8) or is there any other file that I need to consider?

I also rooted my phone to get access to com.whatsapp folder. Found it in the root @ data/data/com.whatsapp

File structure on the root

+ com.whatsapp
  + cache
  + databases
    - axolotl.db
    - axolotl.db-shm
    - axolotl.db-wal
    - msgstore.db
    - msgstore.db-journal
    - wa.db
    - wa.db-shm
    - wa.db-wal
  + files
  + lib
  + shared_pref

File structure on SDCard (old backup )

+ WhatsApp
  + Databases
    - msgstore.db.crypt7
    - msgstore-2014-11-17.1.db.crypt7
    - msgstore-2014-11-18.1.db.crypt7
    - msgstore-2014-11-19.1.db.crypt7
    - msgstore-2014-11-20.1.db.crypt7
    - msgstore-2014-11-21.1.db.crypt7
    - msgstore-2014-11-22.1.db.crypt7
    - msgstore-2014-11-23.1.db.crypt7
    - msgstore-2014-11-24.1.db.crypt7
  + Media
  + Profile Pictures

File structure on SDCard (present backup )

+ WhatsApp
  + .Shared
  + .trash
  + Databases
    - msgstore.db.crypt8
    - msgstore-2014-12-9.1.db.crypt8
    - msgstore-2014-12-10.1.db.crypt8
    - msgstore-2014-12-11.1.db.crypt8
    - msgstore-2014-12-12.1.db.crypt8
    - msgstore-2014-12-13.1.db.crypt8
    - msgstore-2014-12-14.1.db.crypt8
    - msgstore-2014-12-15.1.db.crypt8
    - msgstore-2014-12-16.1.db.crypt8
  + Media
  + Profile Pictures

EDIT: Is it possible to uninstall whatsapp, reinstall and recover old backup (crypt7) first and when everything is working, import latest backup (crypt 8)? No replies so far - Is this even possible ?? Eagerly awaiting a response.

  • Try reading this FAQ first. I think it's related to your issue. But I'm not sure if you could merge crypt7 and crypt8 DB files. – Andrew T. Dec 22 '14 at 7:26
  • Thanks Andrew... I have already read this. You cannot merge two files of different encryption using this. Thanks for your concern. – Mumbai CabinCrew Dec 22 '14 at 8:23
2

This is how I solved the issue.

  1. backup your existing whatsapp installation

     adb backup -f whatsapp-new.ab -noapk com.whatsapp
    
  2. clear whatsapp data by going to settings>apps

  3. upload your old database to /sdcard/WhatsApp/Databases and delete other files in this directory

  4. run whatsapp, restore messages and initialise app (you will have to reenter your phone number; if this doesn't work try installing older version of whatsapp - 2.11.432 worked fine for me)

  5. backup installation with old messages

     adb backup -f whatsapp-old.ab -noapk com.whatsapp
    
  6. download android backup extractor (https://github.com/nelenkov/android-backup-extractor), and its dependencies (bcprov-jdk15on-151.jar) and compile it (use Eclipse if you are not familiar with this)

  7. extract files from backups

    java -cp path-to-libs/bcprov-jdk15on-151.jar:path-to-comiled-abe/bin/ org.nick.abe.Main unpack whatsapp-new.ab wa-new.tar
    
    java -cp path-to-libs/bcprov-jdk15on-151.jar:path-to-comiled-abe/bin/ org.nick.abe.Main unpack whatsapp-old.ab wa-old.tar
    
    tar xvf wa-new.tar
    mv apps apps-new 
    tar xvf wa-old.tar
    mv apps apps-old
    
  8. copy unencrypted databases to a new directory

    mkdir plain
    mv apps-old/com.whatsapp/db/msgstore.db plain/msgstore-old.db
    mv apps-new/com.whatsapp/db/msgstore.db plain/msgstore-new.db
    
  9. download sch3m4's wforensic from Github, install it and follow this https://github.com/sch3m4/wforensic#merging-all-msgstore-files-into-a-single-one (alternatively you could just merge both .db files - they are plain sql3 archives)

  10. clear whatsapp data on phone again; upload the merged database to sdcard/WhatsApp/Databases and name it msgstore.db and delte other database files

  11. repeat step 4

Now you should be able to see all conversations (hint scroll down to see all conversations - they are not sorted chronologically - but that sorts out with time).

  • Unfortunately when I try to install an older version of Whatsapp to load my crypt7 database backup, I get the following message : "This version of Whatsapp is obsolete since ... please download lastest version". I tried modifying the system date but whitout any succcess. – Yann39 Mar 15 '15 at 21:19
  • 1
    Sorry, I'm afraid I cant't help you then. It worked for me back then. Seems they check versions on their servers. But that's the problem with closed-sourced proprietary solutions, you basically agree that you can't actually access your data - it is their service and they can do anything they want... I switched to open source alternative Telegram. – smihael Mar 16 '15 at 11:35
  • OK I think I will switch to another alternative too. Thank you for your help! – Yann39 Mar 16 '15 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.