Friday, October 15, 2004

Recovering that we shall not speak of

So you just hosed your SharePoint site, your boss is breathing down your neck because his kids pictures he shared with everyone are now gone.

Don't panic, SBS' got your back.

That's right, by simply completing setup (As Mir puts it) and following the To-Do list, you've got a great backup of your SharePoint site in your SBS backup and you don't even know it. No, I'm not talking about having to run that funky stsadm.exe command every night (because even though I gave you the steps, I forgot to do it .. whoops!).

So how can you recover SharePoint from just a bunch of WMSDE database files? Give these steps a try:

  1. Un-install the SharePoint WMSDE instance

  2. Un-install SharePoint

  3. Install the Intranet component again using Add/Remove for SBS (Also known as maintenance mode)

  4. Un-extend the virtual server using the stsadm.exe command:
    stsadm -o unextendvs -url http://companyweb

  5. Detach the databases from the clean install:
    osql -E -S {server}\SharePoint
    this will connect you to the osql console, then run these commands:

    • sp_detach_db 'STS_Config'

    • sp_detach_db 'STS_ServerName_1'

  6. Attach the old database files (which will require you to restore them first)

    • sp_attach_db 'STS_Config', '{path to original dbs}\STS_Config.mdf', '{path to original dbs}\STS_Config_log.ldf'

    • sp_attach_db 'STS_ServerName_1', '{path to original dbs}\STS_ServerName_1.mdf', '{path to original dbs>\STS_ServerName_1_log.ldf'

  7. Almost there, now just Extend the virtual server using the command: stsadm -o extendvsinwebfarm -url http://companyweb -vsname companyweb

That's all there is to it, you should be able to browse to http://companyweb and impress your boss with your mad DOS typing skills.

I've had trouble gotten this to work when using a funky downloaded web-part. If this is your case, you can still browse into the Companyweb via WebDAV and extract all the files, that's at least something!

Of course the easiest way to backup and restore your SharePoint site are scheduling a task to run this command:
"%SystemDrive%\Program files\Common files\Microsoft shared\Web server extensions\60\Bin\Stsadm.exe" -o backup -url http://Companyweb -filename {target_path} -overwrite
Then you can simply follow the steps in the Backing Up and Restoring Small Business Server white paper, starting on page 16.


Hiren said...

Hi Sean,

Excellent Article P.S.

Will this method work on Sharepoint 2007. I had a sbs 2008 which crashed and all I have are the original databases, I have built a new sbs 2008 server and was wobering if this method work with wss 3

Kind Regards

Hiren Patel

Sean Daniel said...

I don't see why it wouldn't