Restore SMS messages from Sony PC Companion

Prelude

This is an addition to an article about restoring your contacts. The tutorial can be done on Windows, Mac or Linux and is totally free. In the end you will get an xml file, that you can put back on your phone.

My program got downloaded over 30.000 times and I got a lot of great responses, so chances this solution works for you, are rather high!

Restore data in 18 easy steps

For this solution you need to install Java (RE)! Time estimation for the tutorial: 15 minutes

The program works on Windows, Mac and Linux, with this 12 step guide you will be able to restore your messages, but you could use it for any other files as well.

  1. Download my program: Download (Alternative Download).
  2. Extract the folder “RestoreSMS” in there to your desktop (Just drag and drop it).
  3. Navigate to the folder your backup is saved to. By default your backup is saved to C:\Users\YourUserName\Documents\Sony\Sony PC Companion\Phone Backups
  4. You should find the backups with the file extension “.dbk”. Create a copy of your backup (ctrl+c, ctrl+v) just in case something goes wrong.
  5. The dbk extension is actually just a zip file, so you can just rename the file. If you see the .dbk extension in the file name you can skip this the step. Otherwise you have to disable a windows explorer feature. For that click in your opened window on organize -> Folder and search options and there switch to the tab View and disable the feature Hide extensions for known file types.
    show guide to show file extensions in windows 7
    show file extensions in windows 7

    If you having this problem with an other version of windows just google “windows yourVersion show file extensions”.

  6. Rename your file copy to backup.zip (F2)
  7. Open your file (double click). If you have no program to open zips I highly recommend 7zip.
  8. Now you have to navigate to your message file. You will find it here
    Applications\com.android.providers.telephony\fullbackupdata
    If none of these folders exist the backup won’t have the sms-data included.
  9. Copy the fullbackupdata file to the folder on your desktop from step 2. Put it in the folder “RestoreSMS\1” (Just drag&drop it there).
  10. Now double click on “restoreData.jar” which is in the folder “RestoreSMS\1”. Within a few seconds a file with the name “restore.tar” should show up. If it doesn’t make sure that you have java installed and the fullbackupdata file is in the folder.
  11. Open the file with 7zip or a similar program.
  12. Now navigate through the folders to
    apps\com.android.providers.telephony\db\mmssms.db
    This file holds the messages you are looking for. Sadly you can’t import it that way. First we need to parse it to get an XML file.
  13. Copy the mmssms.db file to the other folder (“RestoreSMS\2”).
  14. Now double click the program “RestoreSmsToXML.jar” in the same folder.
  15. If everything worked out the right way, you should get a file called “extractedSMS.xml”. This is the file you can put back on your phone. Therefore connect your phone with the pc and upload the file to your phone.
  16. To get the messages back to your message app you need to download another app called SMS Backup & Restore. I have no connection with the person who created that application, but it is for free and serves our purpose.
  17. In the app you just have to click restore and search for the xml file you put on your phone.
  18. That’s it, you should have your messages back on your phone!

For all interested, the program is a fork of Android Backup Extractor by Nikolay Elenkov. He actually did almost all work, I just added a few changes to make the program easier to use (for this particular problem). Most of the SMS restore work came from Huỳnh Giang SÆ¡n. thank you for your work, otherwise I wouldn’t have had the drive to put up this article here.

I hope this program helped you. If so, I would be happy if you leave a comment or show your appreciation by click the paypal button. I’m also happy to hear from you, if you hadn’t had problems!
If you want to restore your contacts, take a look at this article.

38 thoughts on “Restore SMS messages from Sony PC Companion

  1. Awesom work!, thank You soo much Johannes!
    I have tried and tried but no success until I got hold of this!

    My old phone got wierd after upgrade so I just could get the Sony dbk-file out…and this guide helped me to suceed!

    Greetings from Sweden

  2. almost 5600 sms from years back was restored 😉
    (yes Im a keeper)

    Greatful U took the time to share youre knowledge!

  3. Success! Thanks thanks thanks Johannes, I’m now trying to figure out how to restore my Notes since the newest Companion (ex pc-companion) failed miserably to restore all my backup made under Lollipop to my downgraded KitKat.

  4. I have finally restored old messages from my sony experia zr to samsung s7!!! I have searched for days for a solution to my problem from sony’s app to samsung’s app and downloaded so many useless restore apps. Thank you so much!!! Your tutorial worked! I am so grateful 🙂

    1. Awesome to hear that I was able to help you, thanks for the feedback and sorry that you had to click through so much crap before, I had the same problem before I developed this small application.

  5. Thanks, Johannes. My Sony Xperia Z3 crashed so had to buy a new phone (HTC M10). So grateful for this program. Helped me restore thousands of messages.

  6. Hi,
    After restoring my contacts thanks to you i restored my sms !

    But i only get received message, is this method suppose to restore send and received message ?

    PS: Have you a magic thing to also restore notes ?

    Thanks !

    1. I get back my 8000 messages :D, is was just a bit long that’s why i did not see my send messages, thanks a lot for you hard work !

      Any solution for notes ? i’ve got a long list and it would we great if you know how to get it ?
      I open the fullbackup file of notes and i got these files :
      notes.db
      notes.db-journal
      google_analytics_v2.db

      Can i do something with this ?

  7. Thank You very much for this tutorials: address book restore and SMS restore.
    Informations was very useful.
    You are great

  8. Hi Johannes,

    I tried to use your program, but the Xperia companion encrypted the backup file (I have the password, but due to rolling back android on my phone, I cant use companion to restore SMS any longer) When I run your program using the java command line, I get a runtime exception:

    Exception in thread “main” java.lang.RuntimeException: java.lang.IllegalArgumentException: Backup encrypted but password not specified
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:196)
    at org.nick.abe.Main.main(Main.java:38)
    Caused by: java.lang.IllegalArgumentException: Backup encrypted but password not specified
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:86)
    … 1 more

    Can you help me figure out where to go from here?

    Cheers!

    Sri

    1. Hi Sri,

      I have bad news for you. The encryption for backups via Sony PC Companion was added long after I created this small tool. There is a possibility to use the program for backups encrypted via android itself, but not with Sony PC Companion. It is using an other encryption procedure and I don’t know which one. If you can figure that out, I might be able to add the decryption to this little application as well.

      Greetings from Germany,
      Johannes

  9. I have a problem with encryption as well. Backup created with Xperia companion as well. Difference is there is no .dbk file (afaict), but the files from the phone are stored separately in Xperia companion subdir called “backup”. I have the “fullbackupdata” file from “socialphonebook”, but can’t get it decrypted with Johannes’s tool or abe. Abe gives me this error:

    Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded

    When i open the file in text editor i see this at the top:

    ANDROID BACKUP
    3
    0
    AES-256

    Some googling revealed this:

    “The first line is the file ‘magic’, the second the format version (currently 1), the third is a compression flag, and the last one the encryption algorithm (‘none’ or ‘AES-256’).”

    https://nelenkov.blogspot.de/2012/06/unpacking-android-backups.html

    Johannes can you make any sense of this? Is the problem maybe that third flag (compression) is set to 0?

    Thanks for all your great work.

    1. Hi Michael,

      You did your job rather well! Sadly the information at the top is the same as with an encrypted file from android, so there is no difference there. I guess that sony is using some kind of salt or a slight variation in their AES256 implementation which is different to the android one. That’s why you get the error, it is just not matching the encryption and therefore read the wrong way. I haven’t figured out a solution to this problem / I have no idea what sony does with their encryption.

      Greetings from Germany,
      Johannes

  10. Good day, I want to say Thank you for your help and of corse of your program, but I have a little problem. I had create pdk file, and change his extension, and do all steps, BUT, when I trying to launch restoreData.jar nothing happend, but when I’m trying to open it with java (java -jar restoreData.jar) I get a mistake like this:
    D:\>java -jar restoreData.jar
    Magic: ANDROID BACKUP
    Version: 3
    Exception in thread “main” java.lang.RuntimeException: java.lang.IllegalArgument
    Exception: Don’t know how to process version 3
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:180)
    at org.nick.abe.Main.main(Main.java:35)
    Caused by: java.lang.IllegalArgumentException: Don’t know how to process version
    3
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:64)
    … 1 more

    D:\>

    and I really didn’t know what to do. Help me please

  11. Hi Johannes,

    My problem is that I created a backup on my sdcard. So there is no “full backup” per say and that is why your application is crashing for me 🙁

    The backup I created on the sdcard has individual files for contacts such as “CONTACTS” and “CONTACTS_meta” and a few more.

    I would really appreciate your help!

    Cheers,
    Omer

    1. Hi Omer,

      I didn’t even know that that was possible with Sony PC Companion… or did you use an other program /app?
      I can’t really tell what is going on, because nobody with that problem came to me. If you want to, you can send me one of those contact files and I’ll take a look if I can make any sense from it.

      Greetings from Germany,
      Johannes

      1. Hi Joannes,

        Cheers for the quick reply. I’m sorry if I wasn’t explicit in my earlier message. Those files were created by the phone itself when I chose to “Backup” using the native Sony Backup and Restore app onto the sdcard.

        Sure I can send it across, may I know your email address?

        Cheers,
        Omer

          1. Hey there,

            I did some research. The files are encoded totally different than from the normal backup process. There is another person with the problem you have over there: https://talk.sonymobile.com/t5/Xperia-Z5-Z5-Compact-Z5-Premium/Decode-SonyBnR-Backup-amp-Restore-files/td-p/1167069

            I took a quick look if there is any program that can easily decode the files, but sadly the XT standard is not that popular and you would also need the information of how the xml is structured (an xsl file) in order to decode it.
            Sadly I won’t have the time to help you out on this one (especially because the result if it will work is rather uncertain). Maybe you will do a better research than me or maybe you have your files synced somewhere else? (e.g. Google: http://contacts.google.com/)?

            All the best,
            Johannes

  12. Hi Johannes,
    Very useful article, thank you!
    My old Xperia M died two days ago. With the help of your program I could restore my SMS messages from the last .dbk backup file to a new Huawei phone.
    Is there a way to restore the MMS messages with pictures as well?
    As I understood from the .dbk structure the pictures are also stored in the backup file so theoretically it is possible I think.
    Thank you again
    Peter

    1. Hey there peter,

      Thanks for the comment, I’m happy you got it working right away. As for the pictures: Well, there are included in the backup if you checked it when doing the backup. My guess is, that the pictures will be stored a .jpg files somewhere without the direct context of the messages themselves. That should make it easier to retrieve them. I can’t tell you where to find them, but I would suggest to sort the folders in the dbk file (which you converted to a zip) by their size. You can easily do that with 7zip. Take a look at the folders that are larger than 10 mb.

      If there are no fullbackupdata files but just some strange names there try to add the file extension .jpg and see if you can open the file as a picture. I remember one case in which that technique worked for audio files, maybe it can work you too. The files do not have to be jpgs, but some could be. That would be my way of solving the problem. Not that elegant, bu it might just work 😉

      All the best and happy holidays,
      Johannes

  13. Thank you very much. With help of your app I recoverd my daughter Exploration worlds she has been building since many months! Thanks I manage to make a backup previously.
    I will donate you tomorrow.

  14. Hi Johannes. Do you if and how can I merge 2 backups? I have a very old backup that has parts of conversations and the current database in my phone which is missing those conversations. I want to merge everything together.

    Any idea about how to do this?

    Thanks!

    1. Hi Victor,

      So it is about sms conversations? Hm, well couldn’t you just follow the tutorial with both backups and merge the data by importing both files with the sms backup and restore app? Or does that app override already existing messages?

  15. Hi Johannes,
    I am eager to extract my messages from a Sony Companion backup file. The device from which I made a backup is no longer working.
    I could not locate the *.dbk file. Nonetheless, I could find under C:\Users\SaiRam\Documents\Sony\Xperia Companion\Backups\4eb337a43ffb2363de915aa9be0316df8342eb1f\f8bb6cada032e9fd29c23aa18741b3694b2db9b9\com.sonyericsson.conversations a file called fullbackupdata. I renamed this file as .zip (I am not sure, if my approach is right). However, upon double clicking restore.jar, nothing happened. I have Java in my system. I use Windows 10. I tried opening fullbackupdata.zip. It’s password protected. I used the password through which I created the backup file. Doesn’t work.
    I will be grateful if you can advise.
    Thanks and Regards.

    1. Hi Shekhar,

      You have just a different file structure (even though I don’t know why some people have a file structure like you have, and most other have the one I was describing). In your case, you don’t have to rename anything. Just take the fullbackupdata (the one you renamed to fullbackupdata.zip) and run my program on that file. In the tutorial start at step 7 🙂

      Greetings from Germany
      Johannes

  16. Hi Johannes,
    great work and I appreciate it!
    sms and contacts extractor worked very well.
    One question regarding the calendar items, I think that RestoreSmsToXML.jar can be used too, just xsl file should be update according to calendar file structure.
    Is that right?

    Thanks,
    Tomas

    1. Hi Thomas,

      Happy to hear that I was able to help 🙂
      As for the calendar: Not quite sure how the file structure of the calendar is, and if it is really xml how to get the xsl file. If you find a .db file you can use something like sqlitebrowser to take a look at the data. If you find a solution please let me know 🙂

Leave a Reply to Thibaud Cancel reply

Your email address will not be published. Required fields are marked *