We have to move site collection to dedicate content database when content database size growing too large. One content database present under a web application in SharePoint contains multiple site collections. We can create or add new content databases under web application when limit of maximum number of sites that can be created in this database exceed while creating new site collection. If one site collection present under a content database is growing large, user request to create a dedicate content database and move that particular site collection to another new content database. We need to follow the steps as described below to move site collection to dedicate content database.
- Get site collection GUID using powershell
- Get which content database site collection web application is stored
- Create new content database in SharePoint
- move site collection to different content database
- IISRESET SharePoint server
- Post Implementation testing
Get site collection GUID using powershell
Before you move site collection to another content database, get guid of sharepoint site. You can get site collection guid using powershell script as mentioned below.
$site=Get-SPSite http://win-q2repghf9du/sites/TeamSiteClassicRenamed
$siteguid=$site.id
echo $siteguid

Get which content database site collection web application is stored
Get site collection content database details including web application, site url using the powershell command below.
Get-SPSite | Where-Object {$_.Url -like "http://win-q2repghf9du/sites/TeamSiteClassicRenamed"} | select Url, ContentDatabase, WebApplication

You can use the alternative command as described in my old post link below.
content database in sharepoint
Create new content database in SharePoint
I described in detail about how to create or add a new content database in SharePoint in my previous post. Follow the post linked below for more details and use the powershell script for creating content database.
create add a content database in sharepoint 2019
New-SPContentDatabase "WSS_Content_DB2" -DatabaseServer "WIN-Q2REPGHF9DU" -WebApplication http://win-q2repghf9du/ -MaxSiteCount 1 -WarningSiteCount 0


move site collection to different content database
Now we are ready to move site collections between databases using the powershell command Move-SPSite as described below.
Move-SPSite "http://win-q2repghf9du/sites/TeamSiteClassicRenamed" -DestinationDatabase "WSS_Content_DB2"

IISRESET SharePoint server
You will get a message in powershell window like “IIS must be restarted before this change will take effect. To restart IIS, open a command prompt window and type iisreset”. You have to do IIS reset SharePoint server.
iisreset

Post Implementation testing
After move site collection to new content database completed, you can check GUID of the site collection again. Its same as source location.

check content database of site collection to cross check the new content database as destination location.

Categories: administration, content databases, powershell command, SharePoint 2019, sharepoint server, site collection
You must be logged in to post a comment.