• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

recovering "deleted" data from a database

ZippyDan

Platinum Member
i wasn't really sure where to put this since it falls under

Apple - iPhone
Databases

but i figured the iphone part is mostly irrelevant and this point, and i also figured programmers would be the most likely to have experience with databases, so ...

on my iPhone, I accidentally "Cleared All" txt messages for a contact that is very important to me (imagine this: I had auto lock off and somehow in my sleep managed to "Clear All" and confirm)

In a panic, I grabbed the SMS.db off my (jailbroken) iPhone via SSH ftp.

I opened the db using SQL Lite Browser (see sourceforge).

Alas, the cleared messages were not there when I exported to excel and searched for the phone number.

But I opened SMS.db using humble notepad, and even though the file is a disastrous mess to read, Ctrl+F has shown me that ALL OF MY CLEARED MESSAGES still exist in the file.

I'm guessing that the messages all still "exist" in the database, but that all the pointers/links/etc. to the messages have been deleted.

In the jumbled/nonsensical state that the database appears in notepad, it would take days of work to reassemble the 100s of messages (sent over several months) one by one into some sort of readable log.

And yet they are there, taunting me! Is there any SQL expert here who could point me in the right direction?
 
I think essentially the pages have been marked available, but not overwritten. I don't know if you can recover the data through some management command, but if you can see the text in Notepad why not just search for what you need to recover and copy it out?
 
I think essentially the pages have been marked available, but not overwritten. I don't know if you can recover the data through some management command, but if you can see the text in Notepad why not just search for what you need to recover and copy it out?

I can do that, however:

1. I'm not 100% sure they are in order. They are timestamped so they could be put in order if I could sort
2. They are garbled in different ways: random characters litter some messages, as well as odd spacing
3. There are hundreds of messages at least, it would just take a lot of work to manually reformat it into something readable.

Of course, I will do that as a last resort. I'm just looking to see if there is a way I can restore it to a form that I can see it in spreadsheet format and easily sort, edit, and format it.

P.S. I'm not looking for a particular message, I just never intended to "delete" that history, and I'd like it to be archived for posterity. 🙂
 
do a test DB, insert some records, take a snapshot of it

now delete those records and take another snapshot. See what the diff is using a hex viewer

This could point you to how to recreate the headers/pointers etc and might let you "undelete" your data.
 
I would think there is a tool for raw db editing that allows you to do things like compaction and inspecting data in unused records and undeleting them, or at least copying the fields to a new record.
 
Back
Top