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.
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!
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.
Yahoo also had the post cached:
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:
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.
Comments (15 responses)
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! 🙂
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.
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.
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.
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.
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.
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
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.
It is very important to backup all your blog content in this scenario
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!
Hi Amin, thanks for the great post! I had some problems on the installation too recently, might be a database error as well.
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.
I am glad is was of some help to you Nina. The Pleasure is all mine 🙂
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.
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!