How To Create SharePoint 2010 Site Collection In Its Own DB

Early this week on site deploying SharePoint 2010, the client wanted to create few site collections for their development team. He tried to create using the Central Administration and could not see any options for creating SharePoint site collections in their own databases!

Well, that’s not news to all of us in the SharePoint World! Is it?

It’s back to the command line to create a SharePoint site collection in it’s own database, just like the good old SharePoint 2007 days! The only big change for good being SharePoint 2010 Management Shell aka Windows PowerShell and no more STSADM.

So here we go –

You need to create a new content database for the web application and then you create a new site collection in that content database.

$w = get-spwebapplication

New-SPContentDatabase "DemoContentDB" -DatabaseServer "SQL\SERVER" -WebApplication $w

New-SPSite -OwnerAlias justsharepoint\alpesh -Name "Demo Site" -Template "STS#0"



Teams is a managed path

Template is the default Team Site

Database Server SQL

Database Instance SERVER


That’s it! One more small script to add to my arsenal of PowerShell scripts, as I keep learning bits of this powerful method to deploy and manage SharePoint 2010.

I have few short PowerShell scripts – that I hope to share in the days to come. Feedback and comments [especially on PowerShell or otherwise] always welcome!

Before I signoff, don’t forget to sign up for the newsletter to go into the raffle to win a SharePoint 2010 book!

4 Replies to “How To Create SharePoint 2010 Site Collection In Its Own DB”

  1. You can create Site Collections in their own databases without resorting to the command line or PowerShell. Just create a new database through Central admin and take the others offline (this does not effect current users accessing current site collections) and add a new site collection and it will go into the database that is not offline. Another way I have used is to set the database limits on the current web apps to equal their current number of databases to force the next site collection to be created in the database that does not have its limit reached yet. Both options are quite easy to do and there are plenty of blog entries out there on the specifics but this is how I do all my development by putting the site collections in separate databases for backup and restore. I hope this helps.

  2. Alpesh

    How can we create another site collection in same web application with different database (restored moss 2007 content database)

    Please advise

  3. on new-spsite, you need to have the -contentdatabase param pointing to the content database you created.

    Or you can use restore-spsite and restore from a bak file you created somewhere else with backup-spsite.

Comments are closed.