Thursday, February 13, 2014

What to do with a Large SharePoint Content Database

hmmm... Wondering  what to do with  the content database size that has already exceeded supported size limit (200 GB) and you want to create a new site collection. There are multiple choices available, you can give it a shot:-

Choice#1 :


Choice#2
  • Shrinking the data base in SQL server, it may have a lot of unoccupied space.
DBCC SHRINKFILE (, )
Or
DBCC SHRINKDATABASE

Run sp_filestream_force_garbage_collection (Transact-SQL) to force the garbage collector to delete any files that are no longer needed in File streaming container.


Choice#3
Move existing site collection to other database and this will reduce size.

Run below command to get the site info along with content database sizes :-
stsadm -o enumsites -url http://sitecollectionURL >> d:\siteinfo.xml

Or

To create the list of all site collection in that Content database then use this,
Get-SPSite -ContentDatabase "WSS_Content_"| foreach($site in $_.sites)


Now from the Site info file created in d drive you can identify the site collection that you
want to move to a separate database.

Move-SPSite <http://ServerName/Sites/SiteName> -DestinationDatabase

  • is the name of the destination content database.

Stsadm -o mergecontentdbs -url -sourcedatabasename -destinationdatabasename -operation 3 -filename


Choice#4  Keep the old large databases as it is and create new site collections in a separate database:-
stsadm -o createsiteinnewdb -url  http://sitecollectionURL 
                                          -ownerlogin domain\username 
                                          -owneremail emailid     
                                          -lcid 1033 
                                          -sitetemplate STS#0  
                                          -title sitecollectiontitle 
                                          -description sitecollectiondescription
                                          -databasename DBname


Note: We cannot split a site collection  into  multiple databases.