1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Corrupted Tables

Discussion in 'Troubleshooting and Problems' started by FreshFroot, Apr 27, 2011.

  1. FreshFroot

    FreshFroot Well-Known Member

    Alrighty.. so I wake up today to find 2 of my forums down.

    vB and XF forums.

    Both showing mysql errors, I check the tables and they are ALL corrupted for both forums.

    I don't know how this is possible. I assume something happened on the server side.

    Does anyone know how to properly repair mysql tables.

    Looks like all the XF tables show that they are corrupted. I rain the repair in phpmyadmin with no luck. But I see tutorials online on much different and deeper methods.

    I thought I'd ask here since there is more knowledge for XF here.


    PS: My host is running table repairs, but I thought I'd ask here in the meantime or in case they don't know whey they are doing or can't fix it themselves.
  2. Mike

    Mike XenForo Developer Staff Member

    Really, there's not much that you can do beyond repair tables. If your tables are MyISAM (likely not), myisamchk can be run (while MySQL is shut down!). By default, most of XF's tables are InnoDB though. You can see a discussion of recovering from InnoDB corruption here: http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-corruption/ As you can see, it's fairly complex and would need to be done by the host. Generally, InnoDB should be more corruption resistant than MyISAM, so something catastrophic must've happened on your server...
    FreshFroot likes this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    It's possible you may have to resort to a backup.

    How old is your most recent one?
    FreshFroot likes this.
  4. FreshFroot

    FreshFroot Well-Known Member

    Hi Brogan. My recent backup I would say is almost a month old.

    My host was able to repair the vB database. But the XF is one they are having troubles with.

    I will pass on that link above Mike and see if they can fix it.

    I have NO idea what happened on the server side. I have access them to check the server logs and tell me, but no one has told me what went wrong. But it has to have been something on the server side.
  5. FreshFroot

    FreshFroot Well-Known Member

    Well I'm not sure what my host did. But I checked this morning after submitting a support ticket.

    But both forums are corrupt free. Not sure if they used a daily backup or fixed the tables.

    But things seem to be working now. Just hope the host doesn't further have more issues.
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Good news.

    Take some backups now just to be on the safe side and you should think about doing regular backups, at least weekly if not daily.
    FreshFroot and Walter like this.
  7. Rudy

    Rudy Well-Known Member

    There is NO excuse not to backup a database regularly. On big boards, we obviously need to modify things slightly since a dump can take awhile and causes a load on the database, but on smaller ones, it is just a matter of a couple of cron entries. I use something like this for each database:

    /usr/local/bin/mysqldump --opt -hlocalhost -umyusername -pmypassword db_name > /usr/home/myroot/mysql/db_name_`date +%Y%m%d_%H%M%S`.sql

    (Those are backticks around the date/time string in the .sql filename.)

    I run this daily for each database we have, then I bzip them immediately thereafter. I use another line to delete bzip files older than three days old, similar to this:

    /usr/bin/find /usr/home/myroot/mysql -mtime +3 -type f -exec rm -fr {} \;

    I am looking at doing more frequent backups, maybe three or four times per day, on some databases for clients. We have the server space, and removing files more than three days old keep the size manageable.
    FreshFroot likes this.
  8. FreshFroot

    FreshFroot Well-Known Member

    Thanks for the help everyone.

    I normally used to do weekly backups. But my forums have been slow lately in activity after moving servers. So I've been a bit lazy with backing up.

    One of the worst things you can do is NOT backup weekly.
  9. Rudy

    Rudy Well-Known Member

    Our host does a weekly full backup, and a nightly incremental backup. In the event of catastrophic hardware failures, they also run something they call a "shadow drive" that they can swap within moments to bring a server backup. Still, I like having my own backups to roll back to. The database, being live, needs a backup, but all of the other files on the server are mirrored on my "work" computer.

Share This Page