Thursday, January 24, 2008

Migrating (Moving) SharePoint 2007

Until you actually embark on the task you'd never imagine exactly how difficult it is to sift through all the documentation and HOWTO's on how to move a WSS or MOSS instance from one machine (or farm) to another. Here's an extremely simple technique on how to do just that, funded most generously by a day's labor.

Potential Techniques

There's a lot of ways to move around SharePoint content. Among the most popular is probably the SharePoint Designer and the stsadm.exe tool. Surprisingly enough it's the stsadmn tool that is by far the easiest to work with. I've found that the SharePoint Designer backup/restore process dies all to easily when you're missing an assembly or a <SafeControls> declaration. The stsadm tool however keeps on trucking, which makes it an awesome way to go if you can get access to it. If not, then by all means use the SharePoint Designer. A decent article for using the frustrating technique is available here.

What You Need

A WSS/MOSS instance that's running (the url is accessible) and ready to go. You can of course continue to change it after you modify it but ideally it's ready to be deployed.

What You Should Know

This technique copies EVERYTHING in the content database which is awesome. This includes content types, site columns, lists (and their contents) etc...

What's NOT copied is any application code that you may have dependencies on. This may include Custom Web Parts, custom ASP.NET codes that you've imbedded in SharePoint, Custom Fields, Event Receivers etc...

You will have to copy these assemblies over (usually just the bin directory) manually and then update the web.config on the destination machine with the appropriate <SafeControls> entries and trust levels.

Performing the Backup

1. On the source machine find the stsadm tool (it's normally located at [C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN]). Run the following command.

stsadm -o backup -url http://mysite/ -filename file.bak

2. On the destination machine, use the SharePoint administration website to create a new Web Application and a new SiteCollection, choose a Blank Site as a Site Definition.

3. Copy the .bak file to the destination machine.

4. Run the following command.

stsadm -o restore -url http://mysite2/ -filename file.bak -overwrite

5. All the content has now been moved, all you need to do now is merge the web.config from the source machine with the destination machine and copy over all the assemblies in the bin folder. Everything from Web Parts to custom codes should be there!

Happy Coding,



Ova (Excuse My Reading) said...

what about the loads of errors after running stsadm restore :((
its never that easy dude

Tyler Holmes said...

Hey Merope,

If you want to post some of the errors you've encountered we can talk about them. Assuming the two SharePoint farms/machines are the same version (or the destination server is a greater version) and you migrate any custom application code after the restore it should work swimmingly.