Wednesday, September 23, 2009

How to create Site Collection in a specific Content Database?

Title: How to create Site Collection in a specific Content Database?

We often have this requirement of creating sites collections in a specific content database instead of going into one of the available content databases. So, here are few available ways that can be considered. Every thing has its own disadvantages. So, pick the one which suits you the best.

Option # 1 : While creating the new content database from CA you can set the options in Database Capacity Settings to limit the number of sites along with Warning. However it allows always 1 extra space for one more C-DB. So, you need proper planning well before for it. Ofcourse you can always go and increase it. So it might not be good working idea every time.

Option # 2 : As posted in my previous post use STSADM createsiteinnewdb option. Problem with this model is that you cannot create more than 1 site into the same CDB.

Option # 3 : Moving Site Collections between Content Databases

Per say if the site collection is created in an unwanted CDB, then you can move the site collection to the required CDB using the below statements. However, the issue with this model is you may not have the freedom to do it on production servers. So make sure you script it out properly and provide it to the Administrators.

STSADM.EXE -o enumsites -url http://mysiteiwantetomove > sites.xml

Open the sites.xml file and edit the file so that you would have only those site listing that you want to move.

STSADM.EXE -o mergecontentdbs -url http://mysiteiwantetomove -sourcedatabase
[databasename] -destinationdatabase [databasename] -operation 3 -filename sites.xml

Option # 4 : Take CDB's to offline mode

Go to CA > AM > CDB's and edit.
You can take all other CDB's to offline mode except the one you want to create site collections under. That way, your new site collection will be created in the CDB available in ready mode. Once you create the site collection, make sure you bring back the other CDB's to ready mode.

No comments: