Menu

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.

Extract the folder “RestoreSMS” in there to your desktop (Just drag and drop it).

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

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.

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 file extensions in windows 7

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

Rename your file copy to backup.zip (F2)

Open your file (double click). If you have no program to open zips I highly recommend 7zip.

Now you have to navigate to your message file. You will find it hereApplications\com.android.providers.telephony\fullbackupdata
If none of these folders exist the backup won’t have the sms-data included.

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).

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.

Now navigate through the folders toapps\com.android.providers.telephony\db\mmssms.dbThis 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.

Copy the mmssms.db file to the other folder (“RestoreSMS\2”).

Now double click the program “RestoreSmsToXML.jar” in the same folder.

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.

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.

In the app you just have to click restore and search for the xml file you put on your phone.

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 Huỳ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.

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.

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 🙂

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

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

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.

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’).”

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.

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

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.

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.

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/)?

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

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 😉

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.

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?

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.

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 🙂

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?

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 🙂