(+84) 463.28.7979

What Would You Do If Somehow You Lost all Your Blog’s Content?

I hope this doesn’t happen to anyone else but this morning  my blog Tips and Tricks HQ somehow disappeared from the face of this earth! The day started as usual… I woke up in the morning went to my office and started checking my emails and found out that I received an email fromSiteUptime (SiteUptime is a website monitoring service that checks your website at regular intervals and notifies you via email or SMS if it becomes unavailable) telling me that my site is down.


So naturally I wanted to check if the site is up now. When I entered the site address in the address bar I got the following screen!
WordPress Blog Setup Screen

WordPress Blog Setup Screen

You can probably imagine that at this point I was pretty scared! I always backup my database and WordPress files regularly so I wasn’t completely in the water but what about all the articles that I have posted after the last backup? Not to mention the traffic that I am loosing now!

Anyway, in my case the damage wasn’t that severe. One of my WordPress database tables ‘wp_options’ was marked as crashed and I was getting the following error that I recovered from the ‘error_log’.

[25-Feb-2009 21:03:32] WordPress database error Table ‘wp_options’ is marked as crashed and should be repaired

I opened a ticked with my web hosting company to address this issue.

Contingency Plan to Recover My Blog Content

After opening the ticket, I started preparing myself for the worst case scenario. So in my mind I was going over the contingency plan to recover my blog content. This is what I planned:

  • Restore the Database with the last db backup file.
  • FTP all the WordPress files (last backed up) to the server.
  • Use Google cache to recover the last few articles that I posted after the last DB backup.

If you didn’t know already… Google, Yahoo, MSN search sites cache the content of each page of your site. So you can recover your blog’s content from the search site’s cache. Google is likely to have the most recent content of a blog already indexed and cached. So I checked out Google to see if it has cached my ‘WordPress PayPal Shopping Cart Plugin’ post which I posted after the last database backup. I was a little happy to find out that Google had my post cached.
Recovering Blog Content from Google Cache

Recovering Blog Content from Google Cache
Recovering Blog Content from Yahoo Cache

Recovering Blog Content from Yahoo Cache

Luckily, as I mentioned earlier that my case wasn’t that severe,  my web hosting company repaired the database using the cPanel – Databases – Repair DB function.

How to Restore Your Blog’s Content (Disaster Recovery)

There are quite a few methods to recover a blog’s content in case of a disaster.

Option 1: Using PhpMyAdmin

Use PhpMyAdmin to backup the WordPress database regularly and restore it when you need.

  • How to backup your WordPress database using phpMyAdmin
  • How to restore your WordPress database using phpMyAdmin

Option 2: Use the Export and Import  Tools in WordPress 2.7 and above

In order to export all your blog’s posts, pages, comments, categories etc in an XML file do the following:

  • Go to “Tools” -> “Export”
  • Click on “Download export file”.

The resulting XML file contains your posts, pages, comments, custom fields, categories, and tags.

To restore your blog’s content:

  • Go to “Tools” -> “Import”
  • Choose “WordPress” from the list
  • Browse for the previously saved XML file and hit “Upload file and import”

This will import the content.

Option 3: Use the Cache from the Search Sites

If you have never done any backup of your blog and woke up one morning to find out that your blog has been wiped out from the face of this earth then this option is probably your best bet. Search with the option “Site:your-domain-name.com” in the Google search to get all the indexed pages from your blog to show up in Google search result:
Restoring Blog content from Google Cache

Restoring Blog content from Google Cache

Now you can go through each cached page and copy the content over. This manual approach however is not very realistic for any blog with a lot of posts. I would recommend using a script to automate this process.

  • How to restore a site’s content from Google’s cache using a Python script
  • How to restore your WordPress database from Google Cache through Ruby

Hope this helps some of you sleep better at night knowing that your blog content is recoverable :) Please feel free to leave any suggestion in the comment area below.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>