Tuesday 8 April 2014

Moving a Site Collection to Its Own Content DB in SharePoint 2013

Moving a Site Collection to Its Own Content DB in SharePoint 2013

I wanted to move a site collection to its own content DB and not have any other site collections added. This was for migration purposes but eventually the new content DB will be used for other sites.

The first step to create a new empty content database. Therefore from Central Admin, under Application Management, select Manage content databases in the Databases section:


On the Content Databases page, click on the Add a content database link:
 
 
 
 
On the New Content Database page, enter the new database name and click OK:





Back on the Content Databases screen, click the link of the new content database you created. The Manage Content Database Settings page appears. Change the Database status to Offline:
 
This is such that nobody can add new site collections and have them stored in your new content database. Click OK.

Next, on the server, open SharePoint 2013 Management Shell and issue the following statement:

          Move-SPSite <<http://server/sites/SiteCollection>> -DestinationDatabase <<NewContentDBName>>



 
Run IISReset per the message.
 
Refresh your Content Databases screen and you should see 1 site collection in your new content database, and 1 less in the original content database:





Reference

http://stevemannspath.blogspot.in/2013/03/sharepoint-2013-moving-site-collection.html


Create Site Collection in a Specific Content Database

Create Site Collection in a Specific Content Database

Whenever we create site collection by default it will get stored in a content database which you all know.
But in some scenarios we need sitecollection to be stored in a specific content database. Why? What is reason for storing the site collection in a separate or a specific content database?.
To answer the above question, we need to know that one web application can support multiple content databases and you can store only 200GB of content in one content database. Please see the Software boundary limits for SharePoint 2013.
In real world scenarios you will have to store or create sitecollection into a separate content Database. For example if you have a large number of team sites which may increase in numbers and leads to the size in future to 500GB to 1TB or even more. So you need to create additional content databases for a particular web application.
Example: If you are building portal for a customer and his company have different departments like Finance, marketing, Sales etc. Where you need to store more amount data, in those cases you need to create multiple content databases in a single web application.
Try to use below naming conventions to maintain the databases in a long term prospective for SQL guys who are maintaining your SharePoint databases.
For finance team "Finance_Team_site_Content_Database" , for marketing "Marketing_Team_site_Content_Database" and for Sales "Sales_Team_site_Content_Database" etc.
To achieve our goal perform below steps.

Step 1: Add content Database to web application:

From Central administration screen and under "Application Management" click on Manage Content Databases”.
Click on "Add a Content database".
For example enter Database Name as "Finance_Team_site_Content_Database" under "Database Name and Authentication section" in "Add a Content database" section, leave remaining fields as it is and click ok.
The field Database Capacity Settings can be used, if you want to limit how many sitecollections you can create in a particular content database and give a warning message to the end user while creating the content database.
Please see the below Figure :Add Content Database to add the content database.
Add Content Database
Figure:Add Content Database
For each content Database you add from central administration it will create a database in SQL server.
You can check if you have access to it or ask your SQL DBA if it’s managed environment, if it is a local VM then its up to you :) you can test whatever you want.
Add few more content databases for testing. I have added four content databases here. "Finance_Team_site_Content_Database", "Marketing_Team_site_Content_Database", "Sales_Team_site_Content_Database" and "SharePoint_Journey_2013_Content_Database".
If i create a new site collection from the central administration screen I want to store or create site collection need to store in a particular Content Database, this is our goal correct.
Let’s say I want one Team site template sitecollection for SharePoint-Journey Sales, when I create a site collection with the name of SharePoint-Journey sales it has to store in "Sales_Team_site_Content_Database" content Database.
You can see Database status field in the Figure: Content Databases List shows as started for all the databases.
Content Databases List
Figure: Content Databases List

Step 2: Manage Content database settings:

Before creating sitecollection you have to change the status of each content database status to stopped and only required content database should show started. In our example "Sales_Team_site_Content_Database" content database should be started.
See the below Figure:Database settings , click on all Database names and change Database status from ready to offline except "Sales_Team_site_Content_Database" and click ok.
Database settings
Figure:Database settings
You can see the Figure : Content Databases where only one database status is Started all other remaining are in Stopped status and oberve the "Current number of site collections" against the "Sales_Team_site_Content_Database" is zero.
Content Databases
Figure :Content Databases

Step 3: Create sitecollection:

In the final step we will create sitecollection and try to find in which Content Database it will get stored.
Please use post on how to create a sitecollection in SharePoint 2013. After creating a site collection go to manage Content Databases under Application management section, you can see that "Current number of site collections” is showing "1" against "Sales_Team_site_Content_Database" content Database. See the below Figure. Content Databases
Content Databases
Figure.Content Databases.
After completion of above steps don’t forget to change the other databases settings to Ready i.e. started. To change the status click on Database name and change Database status from offline to ready and click ok. Repeat this step for all the Content databases those are offline.
Congratulation you have completed all the required steps.
Before concluding the topic, one question here is what will happen if you change the status from Ready to offline?.
The answer is during offline You can open the sites in that particular content database but write operation are not possible.
- See more at: http://www.sharepoint-journey.com/create-sitecollection-specific-content-database.html#sthash.AQFFqSAa.dpuf


Reference

http://www.sharepoint-journey.com/create-sitecollection-specific-content-database.html