Go Back   vb.org Archive > Community Discussions > Forum and Server Management
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2009, 02:10 AM
Theater's Avatar
Theater Theater is offline
 
Join Date: Aug 2004
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Database corrupted, need professional assistance.

Hello,

Unfortunately some tables in my database got corrupted and died a painful death. It happened at 7PM CST yesterday, and the initial cause was a network switch failure. This is the error message at that time:

Quote:
Database error in vBulletin :

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on '10.10.10.11' (4)
<<snipped my path>>/class_core.php on line 311
I have two servers for my community. One for the files, and the other for the database. The site was still up but not the database. After 8 minutes it seemed the switch issue had been resolved, but then I started getting several weird error messages:

Quote:
Database error in vBulletin 3.8.2:

Invalid SQL:

SELECT IF(visible = 2, 1, 0) AS isdeleted,



thread.*


FROM thread AS thread






WHERE thread.threadid = 36357;

MySQL Error : Can't find file: 'thread' (errno: 2)
Error Number : 1017
Also:

Quote:
Database error in vBulletin 3.8.2:

Invalid SQL:

SELECT
userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate, user.languageid AS saved_languageid,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid,
language.phrasegroup_global AS phrasegroup_global,
language.phrasegroup_adv_portal AS phrasegroup_adv_portal,
language.phrasegroup_calendar AS phrasegroup_calendar,
language.phrasegroup_postbit AS phrasegroup_postbit,
language.phrasegroup_prefix AS phrasegroup_prefix,
language.options AS lang_options,
language.languagecode AS lang_code,
language.charset AS lang_charset,
language.locale AS lang_locale,
language.imagesoverride AS lang_imagesoverride,
language.dateoverride AS lang_dateoverride,
language.timeoverride AS lang_timeoverride,
language.registereddateoverride AS lang_registereddateoverride,
language.calformat1override AS lang_calformat1override,
language.calformat2override AS lang_calformat2override,
language.logdateoverride AS lang_logdateoverride,
language.decimalsep AS lang_decimalsep,
language.thousandsep AS lang_thousandsep
, cmpspages.layout AS cmpslayout
FROM user AS user
LEFT JOIN userfield AS userfield ON (user.userid = userfield.userid)
LEFT JOIN usertextfield AS usertextfield ON (usertextfield.userid = user.userid) LEFT JOIN language AS language ON (language.languageid = IF(user.languageid = 0, 1, user.languageid))
LEFT JOIN adv_pages_user AS cmpspages ON (user.userid = cmpspages.userid AND cmpspages.pageid = 1)
WHERE user.userid = 69970;

MySQL Error : Can't find file: 'user' (errno: 2)
Error Number : 1017
Etc, etc. Anyway, I tried to have my managed host provider fix this with a repair option through the server since I wasn't able to log into my admin account to do it from AdminCP. They said they could not, so at this point I was going to have them use a backup. The only problem is that when they setup the new database server for us, they never implemented any backup procedure for that box so the only backup I have available is from 2 months ago.

I'm missing 15,000+ posts, a few thousand member registrations, not to mention a heck of a lot of work to the forum itself. So I do have the corrupted current database, and if anyone is willing to help I'd appreciate it. These are the tables they had listed as corrupted:

Quote:
mydatabasename_dbase.postparsed mydatabasename_dbase.profilevisitor mydatabasename_dbase.search mydatabasename_dbase.strikes mydatabasename_dbase.tagsearch mydatabasename_dbase.thread mydatabasename_dbase.threadviews mydatabasename_dbase.user mydatabasename_dbase.useractivation mydatabasename_dbase.word
I have several mods installed, more recently vBExperience, and I think that mod in particular might have played a part in this if say the database server stopped communicating with the file server halfway through a cronjob. I don't know for sure, but I just have a gut feeling. I've PM'd the mod author to find out for sure.

Any ideas?
Reply With Quote
  #2  
Old 05-30-2009, 04:34 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Theater View Post
Hello,

I'm missing 15,000+ posts, a few thousand member registrations, not to mention a heck of a lot of work to the forum itself. So I do have the corrupted current database, and if anyone is willing to help I'd appreciate it. These are the tables they had listed as corrupted:

I have several mods installed, more recently vBExperience, and I think that mod in particular might have played a part in this if say the database server stopped communicating with the file server halfway through a cronjob. I don't know for sure, but I just have a gut feeling. I've PM'd the mod author to find out for sure.

Any ideas?
This might be a long shot but did you have any backups?? Install the back ups and explain the problem, if your board is a busy as you say you should of been doing backups every week

You might be able to get some help at the MYSQL Developer Zone, if anyone knows about MYSQL its got to be them, they will tell you for definate if the databases can be repaired or not, at least you can go to stage two and upload your backup from 2 months ago

heres their site http://dev.mysql.com/

Good luck and let us know how you got on

Reply With Quote
  #3  
Old 05-30-2009, 05:07 PM
Theater's Avatar
Theater Theater is offline
 
Join Date: Aug 2004
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For now the site is running the 2 month old backup, but we're still missing on a TON of changes and data within that period of time. Yes, I am fully aware that we should have weekly backups and I'm doing my best not to flip out on my host. It's a long story, but there should have been a backup going.

Thanks for the tip, I'll give that a look.

--------------- Added [DATE]1243733496[/DATE] at [TIME]1243733496[/TIME] ---------------

It appears that some actual tables are empty like THREAD for example, so restoring it at this point doesn't seem likely. I am able to see 526,307 entries in POST which seems right. The USERS table only has 21 (out of ~80k).

Speaking of which... is there a way for me to add an Admin account through phpMyAdmin? I just want to be able to switch it back to the bad database for a moment, log into the AdminCP, and pull down the Styles file so it will at least save me that part of setting back up.

How do tables get dumped like that anyway? Would it be caused by a mod perhaps?
Reply With Quote
  #4  
Old 05-31-2009, 12:58 AM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Theater View Post
For now the site is running the 2 month old backup, but we're still missing on a TON of changes and data within that period of time. Yes, I am fully aware that we should have weekly backups and I'm doing my best not to flip out on my host. It's a long story, but there should have been a backup going.

Thanks for the tip, I'll give that a look.

--------------- Added [DATE]1243733496[/DATE] at [TIME]1243733496[/TIME] ---------------

It appears that some actual tables are empty like THREAD for example, so restoring it at this point doesn't seem likely. I am able to see 526,307 entries in POST which seems right. The USERS table only has 21 (out of ~80k).

Speaking of which... is there a way for me to add an Admin account through phpMyAdmin? I just want to be able to switch it back to the bad database for a moment, log into the AdminCP, and pull down the Styles file so it will at least save me that part of setting back up.

How do tables get dumped like that anyway? Would it be caused by a mod perhaps?
Well it depends on what happened to the server... think of a server just like your desktop (minus the OBVIOUS differences you technical members ) and what if a power surge came through? Hard Drive or Motherboard could be shot, it's the same with a running/live server in terms of the Database, for example... there were 1k members online interacting with it and creating threads, using mod functions and all when it crashed so something had to give apparently... :erm:

UKBL is right and it's not always your hosts fault, we have the options to do it ourselves via phpmyadmin AND or you can install MySQL Dumper etc.

I would do as UKBL suggest and let the MySQL guys/gals let you know what they think.

In terms of checking the old DB, simply record your DB info from the current config then key in the old DB's name & pw then upload, now check the forums.. they're back but the corrupted one and fyi your members will see this too but it's a quick way to check things out, then re-edit the config and upload again to have the restored forums back.

Stuff like this has happened to the best of us, we can beat ourselves up over no backups but best thing is to learn from it, I do them weekly now both via automatic backup and through me manually doing it just in case eh?! .

S-MAN
Reply With Quote
  #5  
Old 05-31-2009, 01:02 AM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should try this out

https://vborg.vbsupport.ru/showthread.php?t=201319

I use it to back my database up every few days for now.
Reply With Quote
  #6  
Old 05-31-2009, 01:14 AM
Theater's Avatar
Theater Theater is offline
 
Join Date: Aug 2004
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I actually just got phpmyadmin access tonight along with shell access I had to demand through the owner of the host company. We're on a managed hosting solution and pay a premium, but I will checkout that mod Redlinemotorsports to see how well that works out for me. Anyway, moving on from how the backups should be handled...

The site does pull up with the old corrupt database, but I cannot login since the USER table is practically empty. I need a way to insert myself in that USER table I think. Would there be anyway to recover either THREAD or USER table using just the POST table? It seems like it has all the information in there.
Reply With Quote
  #7  
Old 05-31-2009, 02:49 AM
Andy Andy is offline
 
Join Date: Sep 2003
Location: San Francisco
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried using phpmyadmin to repair the user and thread tables?
Reply With Quote
  #8  
Old 05-31-2009, 02:55 AM
Theater's Avatar
Theater Theater is offline
 
Join Date: Aug 2004
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, but nothing really to repair on an empty table however. My only hope I think is to use the POST table to somehow regenerate both THREAD and USER tables. Everything else looks fine, or well enough for the forum to operate again.

--------------- Added 30 May 2009 at 23:38 ---------------

Ah, no such luck unless I hear otherwise. The Grand Poobah has spoken here. I'm going to take one of the handful of users in the USER table and change the e-mail to mine, and see if I can reset the password, set the ID in config, log into AdminCP, and snag that style file from the corrupt db.
Reply With Quote
  #9  
Old 05-31-2009, 03:49 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Theater View Post
My only hope I think is to use the POST table to somehow regenerate both THREAD and USER tables.
I see your logic - but usernames are not stored in the post table, so they would all be lost anyway.
Quote:
Originally Posted by Theater View Post
I'm going to take one of the handful of users in the USER table and change the e-mail to mine, and see if I can reset the password, set the ID in config, log into AdminCP, and snag that style file from the corrupt db.
Not sure if you can access the front-end, but if you can, register yourself a user and then upload tools.php from the do_not_upload directory. You can run the "Restore Admin Access" tool.
Reply With Quote
  #10  
Old 05-31-2009, 04:01 AM
Theater's Avatar
Theater Theater is offline
 
Join Date: Aug 2004
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
I see your logic - but usernames are not stored in the post table, so they would all be lost anyway.

Not sure if you can access the front-end, but if you can, register yourself a user and then upload tools.php from the do_not_upload directory. You can run the "Restore Admin Access" tool.
The post table does include the username:

Attachment 99882

Thank you for the tip about the tools.php file. It will save me a lot of work if I can grab the latest style file. I will admit this part is my fault since it's so easy to download it to my desktop. Sigh...
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 08:37 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09380 seconds
  • Memory Usage 2,307KB
  • Queries Executed 14 (?)
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
  • (9)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete