Restoring AddressBook.sqlitedb to iPhone – A Simplified Procedure

In my previous article, I described how to restore contacts from a backup to an iPhone.  The infuriating thing about restoring AddressBook.sqlitedb to an iPhone is that one can’t just drop in a replacement file, because after you reboot, the new file gets overwritten with an empty one.  I traced the overwriting of the addressbook to a process called dataaccessd.  This process can’t be killed easily, because launchd will automatically restart it if it dies.  After some testing, I have now devised a procedure which is simpler than the one described in my previous article:

This procedure assumes that you have already obtained a copy of AddressBook.sqlitedb which contains the contacts you want to restore.

1. Using iFunBox, navigate to Raw File System/Library/LaunchDaemons and copy com.apple.AddressBook.plist and com.apple.dataaccess.dataaccessd.plist to your computer.

2. Using iFunBox, delete com.apple.AddressBook.plist and com.apple.dataaccess.dataaccessd.plist from your iPhone.

3. Power off and restart your iPhone

4. Using iFunBox, copy your AddressBook.sqlitedb into the iPhone at Raw File System/var/mobile/Library/AddressBook

5. Using iFunBox, copy the com.apple.AddressBook.plist and com.apple.dataaccess.dataaccessd.plist from your computer back to the Raw File System/Library/LaunchDaemons folder in your iPhone.

6. Power off and restart the iPhone, and enjoy your restored contacts.

 

Related articles:

How to Restore Lost Contacts to Your iPhone

51 thoughts on “Restoring AddressBook.sqlitedb to iPhone – A Simplified Procedure”

  1. Sadly, this does not work if you backed up your contacts via ssh and try to restore them after a firmware update..

    1. What happens, is it still clobbering your AddressBook.sqlitedb? What version did you upgrade from? I’ve found if you upgrade from too old a version, the AddressBook.sqlitedb’s are incompatible

  2. Me’s comment from above applies to me as well. I had reentered a few contacts, they were all gone after using the method you describe. None of the previous ones were restored. The version I upgraded from was 4.0 (to 4.33).

    1. That’s too bad. I don’t know for sure why it doesn’t work for some people, except that maybe the file format changes sometimes between versions.

  3. Thanks for this tip. Was searching for a solution for quite sometime now. Just waht i needed. 😀

  4. I have a question that I think you might be able to help me with…I hadn’t ever backed up my phone on a new computer (Window’s OS) and somehow when I tried to back it up before updating to iOS 5 I accidentally deleted them all. I located and opened the contacts file that you described above and saw that while it only has one contact (myself) in the address book, when I open it as a text file I can see the old names, numbers and emails are still contained there (although they are all mixed up). Do you have any thoughts on how this data may be extracted?

  5. this worked like a charm. However, I believe there is a similar phenomenon with trying to restore the sms file (sms.db). I don’t suppose you know how to manually restore text messages after an update?

  6. This worked perfectly for me. Just path for the com.apple.AddressBook.plist was
    Raw File System/System/Library/LaunchDaemons instead of
    Raw File System/Library/LaunchDaemons, perhaps due to IOS version

    You saved me more than 500 contacts!

  7. this method worked with me…im using 3GS with IOS 5.0.1…after copy AddressBook.sqlitedb, com.apple.AddressBook.plist and com.apple.dataaccess.dataaccessd.plist then restart, got progress bar under apple logo..the progress bar still appear after springboard show up…restart again…there goes all my contact…really helpfull..thanx…

  8. I did all steps, but it did not work at all,
    I’ve Iphone 3G,
    the problem is: I just downgrade from version 4 to 3.1.3 and can’t restore the backup because of it’s in a newer version.

    What shall I do?
    Please help !
    Thanks.

  9. Hi Guys.

    my situation is that I upgraded from 4.01 to 5.01 on an iphone4.

    using DiskAid to access the Iphone.

    the AddressBookImages.sqlitedb and the AddressBook.sqlitedb

    from 4.01 don’t work on 5.01, using the above tutorial and I get an empty Contact list on the Iphone.

    it was said in the comments that there could be a compatibility problem.
    if that’s the case, the plan B is to decript the files.

    let me know any ideas and solutions. thx

      1. following this tutorial I got the contacts of the 4.01 out and saved to a .CVS file.

        might be useful for later. at least they’re out and saved now.

        will try to revive the phone app..

        1. Via Itunes:

          iphone/info/advanced/replace information on this iphone/ check Contacts. =

          iTunes could not sync contacts to iPhone because the contacts are in use by the iPhone.

          Close the contacts settings on the iPhone, than sync again.

          double tap the Home button, terminate Phone and Contacs applications.

          +”Same Error is again given by itTunes.”+

          1. Deleting the:
            AddressBook.sqlitedb-shm
            AddressBook.sqlitedb-wal

            files and overwriting the:
            AddressBook.sqlitedb
            AddressBookImages.sqlitedb

            did so without removing the:
            com.apple.dataaccess.dataaccessd.plist
            com.apple.AddressBook.plist

            from the LaunchDaemons folder.

            however the contacts that used to be in those files are not there anymore..

  10. Via Itunes again:

    itunes could not sync contacts to the iPhone because the iPhone canceled the sync.

    what now?!

  11. Hi Lincomatic,
    I BELIEVE I FIGURED IT OUT!

    [long story, fast forward below for the quick solution 😛 ]

    I stumbled upon your blog looking how to restore my backed up contacts.
    I follow your 2 methods and neither of them worked for me. I basically suffered same issue as Michael (the guy posting earlier above)… every time I was copying over the Addressbook.sqlitedb over I could see the contacts in both Phone App & Contacts App but as soon as I press Home button, the Apple logo showed up with a progress bar and after that the contacts were empty again.

    I tried MANY things. None seemed to work. It was frustrating since I thought I was so close on every attempt until you find it does not work. Your 2nd method did not work so I went and read carefully the 1st -long- one trying to figure out. I even tried my own tricks, like firing iTunes and running a Backup straight away just after copying over the file. It actually backed up the contacts as I could see the same file length for the 31bb7ba8914766d4ba40d6dfb6113c8b614be442 file inside the iTunes backup folder. Then I would try to restore the backup and it would fail complaining there was onr file it could not restore. Then I read about the permissions thing. That was the only thing I did not try, but Michael did not seem successful at it. Then I opened the files with SQLite Database Browser. Went on ‘Browse Data’ tab and I compared the field named ‘_ClientVersion’ under ‘_SqliteDatabaseProperties’. I read on another website somebody was telling to edit that field and put 12 on value. That did not make any sense since my backup from 4.2.1 had 33 in there and I noticed that the empty AddressBook from 4.1 had 32. Probably that people was talking about that when FW 3.2.1 or whatever older one was current. I gave it a chance and changed my backup from 33 to 32, saved it and copied the updated AddressBook.sqlitedb over to /var/mobile/Library. Guess what, IT WORKS STRAIGHT AWAY! WITHOUT RESPRING OR REBOOT NEEDED. That is all what it was required.. no need to kill any process nor delete any plist nor change any permissions. So if we extrapolate it to any other iOS version, like 4.3.3 or 5.0.1 I guess it should work.

    So below is a summary of the steps required, which should work for any iOS version:

    [S O L U T I O N]

    (1) FIRST GET A COPY OF YOUR CONTACTS from either an old backup (read posts above to find out where in iTunes backup are the contacts stored and how to retrieve them. Long story short, your best bet is to locate the following filename inside iTunes backup folder: 31bb7ba8914766d4ba40d6dfb6113c8b614be442, copy it somewhere else and rename it to AddressBook.sqlitedb. That will do. Alternatively you could have a copy of the contacts file that you got from accessing your iPhone’s file system by using some file browser like iPhonebrowser or i-FunBox. The contacts file is stored in /var/mobile/Library/AddressBook/ and the file name is AddressBook.sqlitedb. There is also another copy in /var/root/Library/AddressBook/ but I’m not too sure what that one is being used for. Initially I thought one was used by the Phone App and the other by the Contacts App but that is not the case. Also note that many people incorrectly talks about a different path being /private/var/… It is actually the same file accessed (mounted) through a different route. This is a Unix thing if you are not familiar with Unix filesystem…

    (2) Then get a copy of the empty contacts from your current filesystem. WHY WE NEED THAT? Well, as I explained earlier, we would need to match the version (_ClientVersion) under ‘_SqliteDatabaseProperties’ in the old backup of AddressBook.sqlitedb to match the current versdion in your iOS. YOU CAN SKIP THIS STEP IF YOUR ARE RESTORING CONTACTS FROM SAME FIRMWARE/iOS VERSIONS. Otherwise, open SQLite Database Browser (Freeware app, Google it…) and go on ‘Browse Data’ tab and write down the numeric value of the field named ‘_ClientVersion’ under ‘_SqliteDatabaseProperties’.

    (3) now open the backup copy of your AddressBook.sqlitedb with your contacts and edit that field to match the same version number in the current iOS. Save the file! (update it).

    (4) FINALLY copy over the updated copy of your AddressBook.sqlitedb to both /var/mobile/Library/AddressBook/ and /var/root/Library/AddressBook/ and you should see the contacts in your Phone App and Contacts App right away, no need to reboot or anything!

    I spent a few days until I got this right. I honestly don’t know much about the iPhone but I have become an ‘expert’ by just browsing the net and figuring out things by myself. So I encourage people to do so and learn. There is a bunch of crap out there… and it is up to us to filter it and seize the good stuff. Good luck!

    All the Best,
    Enrique,
    a Spaniard from Valencia in SPAIN working in Silicon Valley, California

    1. Thanks! This worked for me! iOS version was the problem… It was not the same as when I did the backup and now on the phone…

  12. u guys might have problem with lower version of ios…i downgraded my 3gs iphone to 4.1 from 5.0.1…i did exactly what stated above…but the contact still empty…did lot of research…found that u need SQLite Manager…its Mozilla Firefox plugin…
    open AddressBook.sqlitedb with SQLite Manager…
    open _SqliteDatabaseProperties table (it is in left column)…
    change _ClientVersion to 12…(mine by default is 35)
    restart your phone…
    if got Apple progress bar after restart, restart again…
    hope it helps…

  13. I just did all of this and now my phone will not boot up. After the final step where I restart phone, it will just sit on the black screen with the apple logo forever. This is while the phone is connected to the usb and computer. It will just keep making that sound that it does when your computer recognizes the iphone is plugged in usb and it has that little apple “thinking/loading” circle going around it.

    The only thing I think I could have done wrong was in step 4: I deleted the existing “AddressBook.sqlitedb” in the Raw File System/var/mobile/Library/AddressBook folded before I copied the other “addressbook.sqlitedb” from my computer into it. Could this be it? I am totally lost. Please help!

    1. I had this happen before.. it was just the springboard messing up. Are you sure you copied the file correctly? Sometimes it will do that when a file is missing, or sometimes you just have to wait a bit longer, and it will wake up. You should still be able to access the file system via USB while it’s like that. If you can’t fix it, then put it into recovery mode and reload the firmware.

  14. Thank you so much. You helped me rescue 1200 contacts which I suddenly lost without any backup…..

    Very Great thank. Great Man….Great Work..

    Haiyan

  15. ok so the _clientversion change worked as far as i can now see my contacts again. BUT if i try to check inside a contact, the phone/contacts app crashes.. whats up?
    i also restored my callhistory, there the contactnames is show and i can tap then and make a phonecall, but i cant do that from contactsapp it just crashes.

    ive changed permissions etc. copied to both locations.
    updated from ios 4.1 > 5.0.1.

    any ideas?

  16. The _clientversion change worked perfectly to restore the contacts from a “normal” 3G Phone with iOS 4.1 to a 3G with Whited00r 5.1 🙂
    Thanks a lot to Lincomatic and Enrique!

  17. Hello, in rawsystem files i cant find the library folder
    i really need help with this any other advice

    1. FOR YOUR NOTES, CALENDER, MESSAGES etc.

      The same process:
      – copy the ‘com.apple.dataaccess.dataaccessd’ file to computer and delete file of iphone
      – restart iphone,
      – copy your notes, messages and calander data
      – copy ‘com.apple.dataaccess.dataaccessd’ back to iphone
      – restart iphone

      HORAY!!
      THANKS SO MUCH!!

      1. Watch out %#$ iCloud JUST DELETED ALL OF THE NOTES OUT OF MY iPhone!
        iCloud is EVIL!
        Luckily, I got most of them out of an old iTunes backup.
        For notes, you don’t need to mess with dataaccessd … just dropping the files in via iFunBox works.

  18. I backed up my iphone 4s copying the entire var directory, it consumed 160gigs for a 32g device. I found the gist of it in a keychain.plist file. What I am needing is to be able to get my old contacts before I made the mass backup and the upgraded from 4.x to 5.1.1. Unfortunately I was recieving the error “Itunes cannot save the backup on this computer” message so I have no other sources other than hoping I have a copy which I can transfer back. I have copied and moved the “Address” files back to the device but my contacts do not seem to be replaced nor changed in any way, I did have prior backup from a year ago but as part of the troubleshooting steps I deleted the old backups, so I am screwed if I don’t figure out how to restore via iFunbox.

  19. Dude, you can’t imagine how much ya helped me. Been messin around trying to use my contacts, no success so far. Thanks again, you rule! 😉

Leave a Reply