Found a lost backup 2 years after a database crash.

Started by mrbandit, November 27, 2023, 03:45:01 PM

Previous topic - Next topic

mrbandit

Without getting into the specifics I'll state the facts.  I'm running at 2.0.18 currently, but have been running SMF for a very long time.  After being sent to work from home, my workstation at work where all of my backups were going was removed and decom'd without my knowledge.  There was over 15 years of data lost in one second.  The community started over and we are about 20k messages in the current database.  Fast forward to last week and I was  looking in my storage shed and came across a box with external hdd's in it.  Curiosity struck, so I abandoned the task at hand and headed to my laptop.  After finding nothing on the first two, I struck gold on the third.  There was a backup with 10 years worth of data in the sql file. 

When the forum crashed all that was lost was the smf_messages table.  All of the original users are still present, so inserting the data back into the messages table shouldn't cause an orphaned message.  The thing I'm trying to research is only restoring the messages and topics tables keeping in mind the ID_TOPIC is probably in use (at least the first 20k).

Would it be logical and successful if I rewrite the MESSAGE inserts to increment the ID_TOPIC values by 20k and match the new value in the TOPIC table inserts as well? 

Sesquipedalian

#1
Since you started a new forum from scratch, trying to merge it with the contents of your old backup is effectively the same as trying to merge two separate forums. There is no completely clean way to do that, but it can be done if you are willing to put up with some peculiarities. Take a look at @shawnb61's mergeSMF.php script. It can help you do this safely—or at least, as safely as it is ever possible to do this.

In your case, you will probably want to make the old backup the primary forum (in the terms of mergeSMF.php's instructions) and your new forum the secondary. This is necessary so that the older posts sort before the newer ones. The downside is that all links to your new forum will now be wrong. You could instead make the new forum the primary and the backup secondary, which will preserve the links to the new content, but then people reading your forum will see the content out of order.

If neither of those options sound good to you, you could instead just restore the backup as a read-only archive running alongside your new forum. That way, your users could still go back to look at the old content without any of the negative side effects listed above.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Kindred

Just as an additional note...   the messages table is interconnected with other tables,  so you can't just take the contents from that one table...  even Shawn's merge script requires two complete databases
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

mrbandit

I am going to attempt to restore data to a new forum install, but I think I need to use an older version.  The restore file is from 2014 and Doesn't have underscores in the names with two words.

INSERT INTO `backup_smf_messages` (`ID_MSG`, `ID_TOPIC`, `ID_BOARD`, `posterTime`, `ID_MEMBER`, `ID_MSG_MODIFIED`, `subject`, `posterName`, `posterEmail`, `posterIP`, `smileysEnabled`, `modifiedTime`, `modifiedName`, `body`, `icon`) VALUES

Any idea which version I would need from the archive releases?  Versioin 1.1.21 appears to have the same table field names.  Once I have it restored I planned to upgrade it to current.

Sir Osis of Liver

There were no database changes in 2.0 branch, any 2.0 database should work with any 2.0.x version.
When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: