July 5, 2016 at 10:52 am #1265
Using the command prompt I loaded an earlier version of a library (from a dumped su file without changing the name) I was working on. Unfortunately I don’t have a copy of the most recent version of the library that was in the database which got over-written. Is there a way to recover the library table that was overwritten / restore the database to the time before the load?
I tried history which shows only the newly uploaded file and Windows File History is not turned on. My windows version is 10 and I was using Suneido Jan 6 2016 version of cSuneido.
ajithJuly 5, 2016 at 11:21 am #1266
No backups 🙁
There should be a suneido.bak if you have compacted or loaded the database.
Before you try anything else, make a copy of the database and put it somewhere safe.
As long as you haven’t compacted (or dump/load), the old data is still in the database file, but there is no easy way to get it.
The history doesn’t work if a table has been destroyed and recreated (as load does).
If you just need a few records you can open a copy of the database with a text editor that can handle large files. (e.g. Scite) Then search for either the name of the record or something in it. If the record has been updated there will be multiple versions in the file. The last one will be the most recent. Then just copy the text. (There will be a lot of unreadable binary data in the file as well, but the text itself should be readable.)
Another possibility is to force Suneido to rebuild the database as of just before you loaded the file. To do this you either need to truncate or corrupt the file at the right point. Again, you want to do this on a copy of the database that you don’t mind losing. The trick is to know what the right point is. If you look at the database in an editor you may be able to see where the load of the new library started. Past that, it may be a matter of trial and error. Corrupting is easy, just overwrite/delete/insert random characters. This will make the checksums fail.
NOTE: If you are using a text editor to truncate/corrupt the database file, make sure the editor isn’t altering anything else, e.g. not changing line endings or altering the binary data. Scite is usually ok.
Once you’ve corrupted/truncated the database file, run suneido -rebuild. It should tell you what date/time it is restoring to. If it doesn’t go back far enough, then truncate/corrupt earlier in the file. If it goes back too far, then take a fresh copy and truncate/corrupt later in the file.
I can’t guarantee this last method will be successful.
Sorry there isn’t an easier answer.July 5, 2016 at 11:41 am #1267
Thanks for the quick reply. I knew it was not going to be easy. Happy to hear that there are some possibilities. I will check them and get back.
I did keep a copy as soon as I recognized the blunder I did.
ajithJuly 5, 2016 at 12:17 pm #1268
I tried with Notepad++ and with Scite. However, I am getting the error: “..\mmfile.cpp:61:ERROR:assert failed: (file_size% MM_ALIGN)==0” when I try to corrupt the database. I did try many different combinations of inserting / deleting /altering characteristics each time on a fresh copy of the backed up db file. But, I keep on getting the above error. I am assuming that I am not breaking the file at the right spot and that I should try again. However, because the error is the same, I just want to make sure that I am not missing anything.
ajithJuly 5, 2016 at 12:29 pm #1269
Sorry, I forgot about that check. The file size must be a multiple of 8. If you delete or insert make sure it’s a multiple of 8 characters. Probably simpler just to overwrite some characters. (Pressing the INS key should switch you to overwrite mode.)July 5, 2016 at 12:31 pm #1270
I did it! I removed one character at a time and after removing 8 characters, Suneido asked for rebuild. Thanks a lot. You saved a lot of my work.
Given the trouble I caused myself, may I ask if it will be a lot of work to implement the option of rebuilding up to a user given time?
Thanks a lot,
ajithJuly 5, 2016 at 12:37 pm #1271
Glad you got your work back 🙂
I have thought about allowing rebuild as of a given date/time. It probably would not be that hard.
I am reluctant because I think it would encourage people to depend on it, which I do not think is a good idea. Rebuild was intended for crash recovery, not for normal usage. It could be useful though.
- You must be logged in to reply to this topic.