Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2023, 05:41 PM
eolesen eolesen is offline
 
Join Date: Jan 2023
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Restoring Deleted Forum Posts

I asked this on the "official" support site and got zero responses but a bunch of views.... so I'll give it a try here.

A few days back, I ran a prune script which got a little too aggressive due to a typo, and posts from 400 days back got whacked instead of 4000 days back.

It doesn't appear that I broke anything yet, but I did a partial restore from the previous day's backup by running thru the following steps:


1) Restored the previous MySQL backup of the live database (live) to a separate database (yesterday)

2) Ran the following database script:

Code:
insert ignore into live.closure      SELECT * FROM yesterday.closure;

INSERT INTO live.text                SELECT * FROM yesterday.text    WHERE nodeid not in   (select nodeid from live.text);

INSERT INTO live.node                SELECT * FROM yesterday.node    WHERE nodeid not in   (select nodeid from live.node);

INSERT IGNORE INTO live.attach       SELECT * FROM yesterday.attach;

INSERT IGNORE INTO live.filedata     SELECT * FROM yesterday.filedata;
​

3) Ran Maintenance -> General Update Tools --> Update Topics

4) Ran Maintenance -> General Update Tools --> Update Forums


Closure has a unique identity key built on parent-child, so the INSERT IGNORE seems to have avoided any duplication. I tried to do a subquery but it wasn't giving a reasonable amount of rows as a result set, so I went with brute force....

The nodeid subquery for Text and Node seems to have also been surgical and only restored what had been deleted.

I made sure to run the script right after the daily backups ran so I had a good point-in-time restore if needed....

~72 hours later, I have normal activity on the forums, and nobody has reported any anomalies, which is a good sign.

Digging into the forums where the deletes took place, it looks like everything restored including attachments.

My counts before and after also look about right for what was pruned:

Topics: 116,016 Posts: 1,218,561
Topics: 151,626 Posts: 1,392,590

Fully realizing this is a "do at your own peril" action, does this look like the right steps or am I missing something else?

Glenn V suggested maybe including the nodeview and noderead tables. Since the threads I restored were all over a year old, I wasn't too concerned with having those values restored but it might make a difference if it were more recent threads being restored.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05115 seconds
  • Memory Usage 2,159KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete