>Restoring your content database from a full DB backup

>I’d been having some serious trouble with outgoing e-mail alerts with my Sharepoint Foundation server, so I decided to do something that I thought was somewhat reasonable: I figured I would reinstall sharepoint and restore my content database.

My server runs on a VM — no safer way to do this from an infrastructural point of view, BTW — so I took a snapshot of my system. I do this as a rule of thumb so that, if there are any cock-ups, I can completely revert to my original state before the procedure. This is where I made my first fundamental mistake. Mental note number one: ALWAYS double-check that you’ve made a snapshot of the right system; it helps if you’re not sleep-deprived.

I re-installed sharepoint and got the default content — so far so good. I then tried restoring the entire farm from my full backup. That should work, right? Wrong. For some shitty reason, you can’t restore the full farm’s state once you’ve reinstalled Sharepoint. I don’t know about you, but I think this sucks. I wanted to restore the state of my VM at that point — that’s when I realized that I’d screwed up and snapshotted the wrong machine. Nice.

I figured that, in the very least, I would want to restore the content database. I tried that right off the bat, and got an error indicating that I couldn’t attach the database to the web application. Don’t you just love those enlightening Microsoft messages? It would appear that the team just loves to think those up. Anyway. What you’re supposed to get out of that message is that Sharepoint cannot attach the content database to the site because one with the same name already exists. In other words, it refuses to overwrite the existing content database.

Thanks to this article by Sharepoint Girl, which essentially coaches you through removing the old content database and adding the new one, I was able to restore my DB. I would, however, like to point out that unless I’m very much mistaken, the article assumes that you have restored the WSS_Content DB under a different name (i.e. WSS_Content_Restore). That’s the only way I got Sharepoint to restore my DB, at least.

One final note: If you can, definitely go for a more robust, clustered installation. The standalone install is shite — doesn’t give you any control of the files, database backups or anything. Standalone is good enough for dev environments, but that’s pretty much it.