5

I want to set by default to create a site collection in an independent content database when creating a new site collection automatically!

Ex: each content database only holds one site collection by default!

Is it possible to do that automatically without using code?

5

I don't think it's possible automatically.

Unfortunately, There is no event receiver triggered when creating/ created a site collection to handle this using event receiver.


However, you can adjust this manually by locking down the content database as the following:

Steps

Before creating a new site collection, you should plan to do the following:

  • Lockdown all the web application content databases.
  • Create a new independent content database for the new Site Collection.

    enter image description here

  • Create a new Site Collection will be created inside the newly created content database.

Check also Lockdown the web application content databases


Another workaround

Using PowerShell to Create a SharePoint Site Collection in an Independent Content Database

Download the full script at PowerShell: Create a SharePoint Site Collection in a Separate Content Database

  • @Tomaz be aware that this is not correct and it is possible to do what you're asking. – Trevor Seward Dec 17 '18 at 15:58
  • 1
    Thanks Trevor, but your answer is not doable in my situation, I need to do it automatically and your answer requires code too, I think Mohamed answer is the correct one, I cannot do this automatically without code! The lockdown solution is the best one in my case! – Tomaz Dec 17 '18 at 19:39
4

Yes, this is possible by overriding the class SPSiteCreationProvider. With this, you can select all of your existing content databases. If you cannot find a content database in the web application that meets the criteria, you could then create a new content database.

You should be aware that this would slow down the site creation process significantly as provisioning a new content database isn't an instant process.

I'm linking to Wictor's article below which references HNSC, but this will also apply to path-based site collections.

SharePoint: Specifying Content Database for new Site Collections when using Host Named Site Collections

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.