Guest Dr. dre Posted February 19, 2010 Report Posted February 19, 2010 (edited) Can anybody give me the command to backup messages through the ADB way, I have manged to get my contacts backed up but i can't find a way to for the messages. I gave this command for the contacts adb pull /data/data/com.android.providers.contacts/databases Edited February 19, 2010 by Dr. dre
Guest kendon Posted February 19, 2010 Report Posted February 19, 2010 iirc it is /data/data/com.android.providers.telephony/databases/mmssms.db
Guest Dr. dre Posted February 19, 2010 Report Posted February 19, 2010 (edited) and what's for call log ? Edited February 19, 2010 by Dr. dre
Guest kendon Posted February 19, 2010 Report Posted February 19, 2010 (edited) Kendon help! sry, no idea. tbh i don't see the call log as important enough to save it... nevertheless if iyou find the answer please post it here. edit: damn am i good :D /data/data/com.android.providers.contacts/databases/contacts.db just extracted it from a nandroid backup and pushed it, works fine. Edited February 19, 2010 by kendon
Guest Dr. dre Posted February 19, 2010 Report Posted February 19, 2010 (edited) /data/data/com.android.providers.contacts/databases/contacts.db just extracted it from a nandroid backup and pushed it, works fine. Dude I have pulled this file already but haven't tried pushing it back, so does this restores the call log or just the contacts ? Edited February 19, 2010 by Dr. dre
Guest kendon Posted February 19, 2010 Report Posted February 19, 2010 Dude I have pulled this file already but haven't tried pushing it back, so does this restores the call log or just the contacts ? both: The call log is surprisingly co-located in the database of the Contacts application.
Guest Dr. dre Posted February 19, 2010 Report Posted February 19, 2010 both: The call log is surprisingly co-located in the database of the Contacts application. Thanks for the help dude. Your the best!!!
Guest kendon Posted February 19, 2010 Report Posted February 19, 2010 Thanks for the help dude. Your the best!!! glad i could help :D
Guest knudsen81 Posted February 20, 2010 Report Posted February 20, 2010 glad i could help :D when i use adb to pull out msg file can i so push it back in any rom???? thanks for you help
Guest kendon Posted February 20, 2010 Report Posted February 20, 2010 when i use adb to pull out msg file can i so push it back in any rom???? thanks for you help i would think that it works with ever "major" version, ie if you pulled it from a 2.73.x.x rom then you can push it back to any of these. for 2.1 i have no idea, just try it?
Guest Trebor Rude Posted February 20, 2010 Report Posted February 20, 2010 sry, no idea. tbh i don't see the call log as important enough to save it... nevertheless if iyou find the answer please post it here. edit: damn am i good :D /data/data/com.android.providers.contacts/databases/contacts.db just extracted it from a nandroid backup and pushed it, works fine. I tried this method (push contacts.db) on my Tmobile pulse, and it didn't work. It deletes all the contacts when I reboot the phone (the .db file size actually changes, and all entries disappear from the 'people' table when I look with sqlite3). Of course, this being a Hero board, I don't know if anyone will be interested in that. :D
Guest Dr. dre Posted February 21, 2010 Report Posted February 21, 2010 I tried this method (push contacts.db) on my Tmobile pulse, and it didn't work. It deletes all the contacts when I reboot the phone (the .db file size actually changes, and all entries disappear from the 'people' table when I look with sqlite3). Of course, this being a Hero board, I don't know if anyone will be interested in that. :D This is a method which is tried and tested on a Hero device, so I don't think this would work on a pulse.
Guest daveba Posted February 21, 2010 Report Posted February 21, 2010 I'm not sure why this thread morphed into backing/restoring contacts, but the original subject was for backing up messages right ? It's actually really easy to do and even to move it from one phone to another. You should never copy the db direct (unless moving onto the same phone/db version), but instead take a sql dump of your data and after ensuring the table columns are in the same order/type, just reimport it into the new db structure. Moral of this is always keep your /data/data/* files backedup. Here is a sample (the sqlite3 command exists for linux/windows/mac): laptop$ sqlite3 data/com.android.providers.telephony/databases/mmssms.db SQLite version 3.6.16 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables addr incoming_msg raw android_metadata part sms attachments pdu sr_pending canonical_addresses pending_msgs threads cbch qtext drm rate sqlite> .headers on sqlite> select * from sms; _id|thread_id|toa|address|person|date|protocol|read|status|type|reply_path_prese t|subject|body|sc_toa|report_date|service_center|index_on_sim 1|1|0|+xxxxx||1259033347278||1|-1|2|||Sample SMS|0||| ..etc... So this command will dump it out for you in text, laptop$ sqlite3 data/com.android.providers.telephony/databases/mmssms.db 'select * from sms' >sms.txt then you can just reimport it into your new db. Remember to put your phone in airplane mode, or do it from the recovery console so to consumers are not updating the db at the same time. I'm sure you don't wanna loose messages. It's trivial to write a script to backup and restore contacts,sms,APN's, etc..
Guest kendon Posted February 21, 2010 Report Posted February 21, 2010 So this command will dump it out for you in text, laptop$ sqlite3 data/com.android.providers.telephony/databases/mmssms.db 'select * from sms' >sms.txt then you can just reimport it into your new db. Remember to put your phone in airplane mode, or do it from the recovery console so to consumers are not updating the db at the same time. I'm sure you don't wanna loose messages. It's trivial to write a script to backup and restore contacts,sms,APN's, etc.. this is interesting, could you give us the command to restore aswell? i am not familiar with sql. the problem here is that many people struggle already to use simple file operations with adb, let alone manipulating the contents of the database... most are capable of copying a file from the phone to their pc and back, but altering databases in between... nevertheless, good argument! :D
Guest daveba Posted February 21, 2010 Report Posted February 21, 2010 (edited) this is interesting, could you give us the command to restore aswell? i am not familiar with sql. the problem here is that many people struggle already to use simple file operations with adb, let alone manipulating the contents of the database... most are capable of copying a file from the phone to their pc and back, but altering databases in between... nevertheless, good argument! :D As mentioned as long as you ensure the columns are in the same order (i.e. the db schema is the same) you should be fine with the following You should first look at the SMS schema with the command .schema sms then first dump the db as i showed previously to a txt file (the sms.txt file in this example) sqlite3 data/com.android.providers.telephony/databases/mmssms.db 'select * from sms' >sms.txt then reload that file into a new db (i.e. a clean phone with no entries or else you will end up with dup entries) with sqlite3 data/com.android.providers.telephony/databases/mmssms.db '.import sms.txt sms' Then push that mmssms.db file to your fone. If someone wants to dump me the schema from a 2.x ROM for the SMS/MMS db i will write you a script from convert from 1.x to 2.x db. It is extremely simple with a few sql commands. As long as you have a backup of the db file you can always revert (i..e push the original via adb to your fone) if it doesn't work. Edited February 21, 2010 by daveba
Guest Trebor Rude Posted February 21, 2010 Report Posted February 21, 2010 This is a method which is tried and tested on a Hero device, so I don't think this would work on a pulse. It did end up working, I just had to force the contacts application to close after installing the db. I suspect the contacts service had something to do with it.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now