Move MOSS Web To WSS

Ever try to import a web from a MOSS server to a WSS server and get those little errors about “Could not find feature xxxx”.  More specifically, the first one you run in to is “Could not find feature OffWFCommon”.  Here is a little trick to get rid of those before you migrate.

$siteurl = "http://blah"
$site = new-object Microsoft.SharePoint.SPSite $siteurl
$web = $site.OpenWeb()

stsadm -o deactivatefeature -url $siteurl -name OffWFCommon
stsadm -o deactivatefeature -url $siteurl -name TranslationWorkflow

$site.features|%{$_.Definition}|?{$_.ReceiverAssembly -like "*Office*"}|select DisplayName
$site.features|%{$_.Definition}|?{$_.ReceiverAssembly -like "*Office*"}|%{stsadm -o deactivatefeature -url $site.url -name $_.DisplayName}

stsadm -o deactivatefeature -url $siteurl -name TransMgmtLib

$web.features|%{$_.Definition}|select displayname,status

Inside: STSADM MERGECONTENTDBS

For those of you that run in to this, it is MUCH FASTER and way more SQL friendly to use MERGECONTENTDBS instead of the BACKUP and RESTORE option WHEN MOVING FROM THE SAME DB SERVER AND SAME WEB APPLICATION.  Why?  Think of what a BACKUP and RESTORE do.  First, the BACKUP writes all the contents of the site to a file, that could be rather big.  Then, the RESTORE puts it back in, which blows up the transaction log as well.  So what does MERGECONTENTDBS do that is so much better?  ANSWER: Skips the whole file process…big improvement in speed and efficiency

Let’s assume the following scenario: 

Database moving from: DB1

Database moving to: DB2

Site GUID:  A63289FB-5404-4B17-BB49-4378EEF2CDB7

 

Steps in the SQL Profiler world…not exact but you get the point

–Lock the site in DB1

–Same as STSADM -o setsitelock -url site -lock noaccess

exec proc_SetSiteFlags ‘A63289FB-5404-4B17-BB49-4378EEF2CDB7’,131072,131072

 

–Run a bunch of INSERT INTO DB1.[dbo].[Table] (Col1,Col2,…) SELECT Col1, Col2,… FROM DB2.dbo.Table

Sites

ComMd

Deps

AllDocs

AllDocStreams

AllDocVersions

ContentTypes

EventReceivers

Features

ImmedSubscriptions

AllLinks

NavNodes

ScheduledWorkItems

SchedSubscriptions

Webs

Groups

GroupMembership

Roles

RoleAssignment

Workflow

WorkflowAssociation

Perms

RecycleBin

SiteVersions

NameValuePair

NameValuePair_Albanian_CI_AS

.

.

.

NameValuePair_Vietnamese_CI_AS

BuildDependencies

AllUserData

UserInfo

WebParts

Categories

AllLists

ContentTypeUsage

WebCat

WebMembers

WebPartLists

Personalization

 

exec proc_SetSiteFlags ‘A63289FB-5404-4B17-BB49-4378EEF2CDB7’,0,131072

exec proc_DeleteSite ‘A63289FB-5404-4B17-BB49-4378EEF2CDB7’

 

–Config DB

exec dbo.proc_dropSiteMap @Id=’A63289FB-5404-4B17-BB49-4378EEF2CDB7′

 

exec sp_executesql N’UPDATE [DB2].[dbo].[Sites] SET BitFlags = @Flag WHERE Id = @SiteId’,N’@SiteId uniqueidentifier,@Flag int’,@SiteId=’A63289FB-5404-4B17-BB49-4378EEF2CDB7′,@Flag=0

 

–Config DB

declare @p8 int

set @p8=1

exec dbo.proc_putSiteMap @ApplicationId=’A32D6D58-99F5-437F-BE32-3233D242BF91′,@DatabaseId=’DF61C0F9-1F4C-49B2-B1A9-99276320359E’,@SiteId=’A63289FB-5404-4B17-BB49-4378EEF2CDB7′,@Path=N’/sites/tester’,@Pairing=0,@RedirectUrl=NULL,@HostHeaderIsSiteName=0,@CurrentDatabaseSiteCount=@p8 output

select @p8

 

That is it…I know, not the prettiest thing, but SQL people get it and now hopefully so does everyone