With SharePoint 2010 starting to appear in several customer sites and those customers considering restructuring the site and database architecture. We thought we should do some experimenting with this. As such I started creating a site structure and then moving the site collections around to see how it all worked.
Power Shell has become one of the critical tools to any SharePoint developer or administrator. To get more information check out some of these great references.
http://msdn.microsoft.com/en-us/library/ee539977.aspx
http://technet.microsoft.com/en-us/library/ee806878.aspx
http://dmitrysotnikov.wordpress.com/2009/10/19/sharepoint-2010-cmdlet-reference/
http://powergui.org/entry.jspa?externalID=2812
What I wanted to do is create several different site collections across different content databases. So Step 1 is create some content databases. To accomplish this I could use the GUI but that’s no fun, so instead I used PowerShell as follows.
New-SPContentDatabase -Name "Name of database to create" -WebApplication "Name of Web Application to create content database in
I needed to run this a few times as to create enough to really test with.
New-SPContentDatabase -Name Wss_Content_Projects -WebApplication Http://sp2010
New-SPContentDatabase -Name Wss_Content_Departments -WebApplication Http://sp2010>
New-SPContentDatabase -Name Wss_Content_Team -WebApplication Http://sp2010
New-SPContentDatabase -Name Wss_Content_Corporate -WebApplication Http://sp2010
Now I had some content database, but no Sites or Site Collections in them. In researching this I found many different less than ideal ways of specifying a content database, but I found that there is one PowerShell command with options that pulls this off in one command. The New-SPSite command has options to specify which content database to create that site in.
New-SPSite -URL "Where to create this site -ContentDatabase "Name of content Database to use"
-OwnerAlias "Domain\account to use as the owner of the site" -template "Template to use"
So I can run the following commands to create corresponding sites to the above databases
New-SPSite -URL <a href="http://sp2010/sites/Departments">http://sp2010/sites/Departments</a> -Cont
entDatabase WSS_Content_Departments -OwnerAlias StoragePoint\Administrator -template STS#0
New-SPSite -URL <a href="http://sp2010/sites/Projects">http://sp2010/sites/Projects</a> -Cont
entDatabase WSS_Content_Projects -OwnerAlias StoragePoint\Administrator -template STS#0
New-SPSite -URL <a href="http://sp2010/sites/Corporate">http://sp2010/sites/Corporate</a> -Cont
entDatabase WSS_Content_Corporate -OwnerAlias StoragePoint\Administrator -template STS#0
New-SPSite -URL <a href="http://sp2010/sites/Team">http://sp2010/sites/Team</a> -Cont
entDatabase WSS_Content_Team -OwnerAlias StoragePoint\Administrator -template STS#0
If you don’t want to use the Team Site as a template you can get a good list of these sites and codes to use here
http://www.toddbaginski.com/blog/archive/2009/11/20/which-sharepoint-2010-site-template-is-right-for-me.aspx
At this point I have several different site collections with corresponding content databases. After I upload some content and ensure all is fully operational I start creating new storage profiles for each content database. Each profile will utilize Remote Blob Storage (RBS)and will be mapped to 1 endpoint. For StoragePoint this should be considered a very basic configuration as it is not taking advantage of any different scope rules. But for testing this should work just fine.
See below for the Profiles

And the Endpoint they map to
Once all of the content in my sites was fully externalized, its time to start moving the stuff around and see how StoragePoint handles it. To Move a site into a different database you can use the Move-SPSite PowerShell command.
Move-SPSite “http://Site URL” -DestinationDatabase "Database name"
So if I wanted to move the Projects site into the Corporate Content Database I would run the following command
Move-SPSite Http://sp2010/Sites/Projects –DestinationDatabase WSS_Content_Corporate
Just in case you were wondering, all these commands worked beautifully, I love PowerShell. But now for the StoragePoint results. When I moved a site that was not externalized into a database that was externalized the content of the moved site stays in the database, and it not automatically externalized. However since this site now falls within a StoragePoint scope any new content that is uploaded is not put into the content database but goes to the specified endpoint
If I want to to externalize that content I have to run the externalize job. But GOOD NEWS you can do that too from PowerShell. Use the Set-BLOBExternalizationJob command. This command schedules externalization job for a specified profile. The job may be run immediately (-RunNow) or at a specified date/time (-JobStartDate). The command has the following possible parameters
• Profile (p): The name or Id of the profile in which to run the job under. REQUIRED.
• JobStartDate (sdate): The start date/time to run the job unless –RunNow switch is specified.
• NumberOfThreads (threads): Number of threads to run the job with.
• RunNow: If specified (-RunNow), then run the job immediately. Ignores any scheduling options provided.
• EmailDefault: If specified (-EmailDefault), send status email to the default notification group setup in General Settings.
• NotificationEmailOther (email): Other email addresses (not in default notification group) to send status emails to.
• EmailOnErrorOnly: If specified (-EmailOnErrorOnly), then send status email only if an error occurs when running the job.
A quick example Example for scheduling an externalization job to run immediately.
Set-BLOBExternalizationJob –p Departments –threads 20 –EmailDefault –RunNow
This will run the externalization job on the Departments profile with 20 threads.
In the case where I am moving sites that are already externalized, the content is moved to the new endpoint specified in the new profile associated with the content database that it was moved to.
For example:
I have 2 Site Collections in 2 databases.
Projects Site Collection in the Projects Database
Corporate Site Collection in the Corporate Database
In this situation the Corporate Database has RBS enabled and is currently externalizing content. The Projects database and site collection are not externalizing at all. If I run the move site command to move the projects site collection into the Corporate database, all the content will be moved into the Corporate Database. You will then need to externalize it with the externalization job from central administration or with the above PowerShell commands.
These PowerShell commands for moving sites into different databases will help organizations better organize and allocate databases and better balance which sites are in which databases. I hope now that you know StoragePoint already has an ability to completely handle this allows you to move forward comfortably. One thing to keep in mind is that you need to test this well before you do anything. If you want to try out StoragePoint and see for yourself what it can do drop us a note at info@storagepoint.com