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 from  SiteUpTime (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.

natural-disaster_128

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

Yahoo also had the post cached:

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.

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.

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.

Found this article interesting? Subscribe to Tips and Tricks HQ

email icon rss feed icon twitter icon google plus icon

Comments (21 responses)

  1. Nil says:

    Thank you so much for sharing this on your blog. Just lost all my content all of a sudden, then I followed your instructions and got all my content back, in less than 10 mins. 🙂 Really thankful that I searched on Google and that directed me to this post, bless you a hundred fold! 🙂 Can’t thank you enough! 🙂

  2. Cosmo says:

    I know this an old thread, but there is a much quicker way to repair the database. Log into phpMyAdmin, select the database and you should see a list of tables in the database, select the box next to wp-options, and choose “Repair” in the dropdown at the bottom of the list. Job done, no loss of data.

  3. Thanks for this tip. I’ve been blogging for a while now and this post just shows how little I know. I’ve never even thought about what would happen if I lost it all. I didn’t realize it could happen.

    I just finished backing everything up and I’m going to bookmark this page as a reminder if I lose everything on how to get the stuff not in the back up yet.

    Thanks.

  4. One24 says:

    If I lost all my blog content I would shoot somebody… Especially if it was one of my sites that is racking in the dough.

  5. Jason says:

    I agree with John…the product called “BackupBuddy” is awesome. It archives your whole blog or it will allow you to make a template for making new blogs.

  6. One24 says:

    Crazy, I never thought about that. I guess I have always figured that my hosting company had my back, however after seeing what you went through I am thinking I need to be more diligent in backing up.

  7. John Gamings says:

    Personally I use a plugin called “BackupBuddy” and it is AMAZING. it makes an exact same replica of a site within 30 seconds, which makes setting up multiple sites a breeze. Definitely a must-have plugin in my opinion

  8. It was a good lesson for you but we sometimes get lessons from such incidents. Even i have a very bad habit of not taking backups. Even my home PC was crashed multiple times and i lost some of my data. It is very important to have backup of your important files somewhere. I think you are lucky in your case it was not a severe issue but many times especially if there is any virus problem, it gets impossible to restore the data and you have to accept the loss. Google Cache is good only to restore content but in case of codings, it won’t help.

  9. sandesh says:

    It is very important to backup all your blog content in this scenario

  10. lcdhdtv says:

    Wow, this post simultaneously enlightened me and scared me straight! I’m never going without backups again! The python script for capturing google cache is on some james bond stuff!

  11. Michiel says:

    Hi Amin, thanks for the great post! I had some problems on the installation too recently, might be a database error as well.

  12. Spitt says:

    My host keeps a backup from the day before, for files. And each day, I am emailed the database. I might lose one day but it would be all comments, since I keep 2 weeks worth of posts in the queue.

    http://www.ilfilosofo.com/blog/wp-db-backup

  13. admin says:

    I am glad is was of some help to you Nina. The Pleasure is all mine 🙂

  14. Nina says:

    Thank you, Thank you! This is wonderful information to have and to use. I printed this page, so I will be prepared. Your blog is amazing! I am grateful that your so generous with your tech expertise and skills.

  15. Wow, it pays to be prepared!

    Thanks for the tip on using Google Cache to retrieve the last few articles that might be missing from your weekly backups. I hadn’t thought of doing that!

Speak Your Mind

*