Creating a New Site Collection with a New Content Database in SharePoint 2010

Sometimes SharePoint overwhelms me and so I track some of the cool or hard stuff that I do and capture it here. This is once such instance. This morning we needed to create a new site collection where we wanted to house all of our team sites. The purpose of this was to put the site collection in a different database. Sounds simple enough right? Problem is you can’t just create or even select a new content database when creating a new site collection.

So off to PowerShell we go. Now we need to create the content database first and here are a couple of ways to do this. One is in Central Administration go to Application Management > Manage content databases > Add a content database. The other is, you guessed it, PowerShell. I chose the GUI, mostly because I found it first. If you want to do it in PowerShell use the New-SPContentDatabase command. It should look something like this:

New-SPContentDatabase “NameOfDatabase” -DatabaseServer “NameOfDatabaseServer” -WebApplication http://SharePointServerName

Once you’ve gotten that created then you’ll have to use the PowerShell command New-SPSite to create the new site collection. It should look something like this:

New-SPSite http://SharePointServerName -OwnerAlias domianusername -Name “Site Collection Name” -Template “STS#0”

Now, I’m assuming you’re thinking what I was thinking. How does it know the content database to use? The answer is, I don’t know but it seemed to know the one I created for it. However to be safe, one should probably add in the parameter ContentDatabase and tell it which one to use.