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.

Monday, January 6, 2014

Powershell script to Install SharePoint 2013

Ohhhhh Yessssss! I am back ....don't ask me after how long I am active on this SharePoint blog (sigh :(  its been almost 3 yrs... )....and the reason for this about - turn is my new year resolution (a deep secret, wouldn't tell you now ;) )... Yes , I am happy that I have straightened my back to continue with my skills and to catch up with the world. So here is my Powershell script that I used to successfully install SharePoint 2013 in POC environment:-

This script can be safely used to create a brand new SharePoint farm:-

PS C:\Users\ Spadmin > Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0 

# Settings
PS C:\Users\ Spadmin  >$databaseServer = " "
PS C:\Users\ Spadmin  >$configDatabase = " "
PS C:\Users\ Spadmin >$adminContentDB = ""
PS C:\Users\ Spadmin  >$passphrase = " "
PS C:\Users\ Spadmin  >$farmAccountName = " "
PS C:\Users\ Spadmin >$farmAccount = Get-Credential $ S_SP2013_Dev_FARM
PS C:\Users\ Spadmin  >$passphrase = (ConvertTo-SecureString $passphrase -AsPlainText -force)

PS C:\Users\Spadmin > New-SPConfigurationDatabase -DatabaseServer $databaseServer -DatabaseName $configDatabase -AdministrationContentDatabaseName $adminContentDB  -Passphrase $passphrase -FarmCredentials $farmAccount

Please run the below command in SQL management studio to set the MAXDOP to 1 for parallel queries before creating a SharePoint farm:-
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE WITH OVERRIDE;
GO

EXEC sp_configure 'max degree of parallelism', 1;
RECONFIGURE WITH OVERRIDE;
GO

EXEC sp_configure;
GO

So, Apply the above recipe to create your very own SharePoint farm, and do let me know if this post was helpful.

Signing off..

Take care!!!!!!!!