Wednesday, September 12, 2012

Move Site Collections between Content Databases



In MOSS 2007 one of content database has grown beyond 100 GB. So I wanted to move couple of existing site collections to another content DB. So I used STSADM to move them.

You can retrieve all the site collections from the source content database using this stsadm command. It will generate a file sites.xml.
stsadm -o enumsites -url http://webAppURL/ –databasename Your_Content_DB > sites.xml

Open sites.xml and remove the sites that you keep in source database. You need to keep site collections entry that you want to move to destination content database. Save the file.
Now run this command to move site collections to another content database.
Merge databases:
stsadm -o mergecontentdbs -url http://webAppURL/ -sourcedatabasename <SourceDB>  -destinationdatabasename <DestinationDB> -operation 3 -filename mysites.xml

In SharePoint 2010 we can achieve the same using PowerShell.
Move-SPSite <URLofSiteColletion> -DestinationDatabase <DestinationDB>

No comments:

Post a Comment