Category Archives: content DB

Set Maximum Number of Site Collections in SharePoint Content Database using PowerShell

For Particular Requirement, client want to dedicate a database for a single site collection. When we create a site collection from central admin, site is placed automatically in any available content database. To prevent any other sites to be created on the particular content database, We can set the maximum number of sites limit.

To set maximum number of site collections on a particular content database, navigate to:

  • Central Administration >> Application Management >> Management Content databases
  • Select our target web application in which the particular content database is attached
  • Pick the target database from the list
  • Now, in the “Manage Content Database Settings” page we can set the maximum number of sites for the content database.

set-max-number-of-site-collections-in-a-content-database

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables for processing
$WebAppURL =”https://sharepointtechnicalsupport.com”
$MaxSiteCount=1
$WarningSiteCount = 0

#Get all content databases of the web application
$ContentDBColl = Get-SPContentDatabase -webapplication $WebAppURL

#Iterate through each database in the web application
foreach($Database in $ContentDBColl)
{
#Check the current No. of sites
if($MaxSiteCount -ge $Database.CurrentSiteCount)
{
#Set Maximum Sites, warning level Counts
Set-SPContentDatabase -Identity $Database.Name -MaxSiteCount $MaxSiteCount -WarningSiteCount $WarningSiteCount
Write-host “Max Sites Settings updated for the database:” $Database.name -ForegroundColor Green
}
else
{
write-host “MaxSiteCount must be > = current site count! No changes made in $($Database.Name)” -ForegroundColor Red
}
}

Advertisements
Retrive account password powershell

Partial Index Reset of a single content source

Partial Index Reset of a single content source

This script will remove and re-add your content source’s start addresses.

SharePoint will more or less rebuild the index for these sources, when the next full crawl is started.

$sourceName = “Local SharePoint sites”

$SSA = Get-SPEnterpriseSearchServiceApplication

$source = Get-SPEnterpriseSearchCrawlContentSource -Identity $sourceName -SearchApplication $SSA

$startaddresses = $source.StartAddresses | ForEach-Object { $_.OriginalString }

$source.StartAddresses.Clear()

ForEach ($address in $startaddresses ){ $source.StartAddresses.Add($address) }

filename invalid or too long 1920x1080

filename invalid or too long SharePoint

Advertisements
Advertisements

The filename invalid or too long. Specify a different filename

"The filename invalid or too long Specify a different filename" error while opening document library in windows explorer mode.

File name invalid or too long

File name invalid or too long

For testing  I tried to upload a single file using browser but its generated error as below:

Sorry, something went wrong.The URL ‘Shared documents/Project budget.xlsx’ is invalid.

File name invalid or too long

File name invalid or too long

Actually filename is not very long at all, including the full path. I looked into the ULS logs (for the time i tried to upload file) and found log as as below:

Exception thrown storing stream in new SqlRemoteBlob: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> Microsoft.Data.SqlRemoteBlobs.BlobStoreException: There was a generic database error. For more information, see the included exception. —> System.Data.SqlClient.SqlException: RBS Error. Original Error: Number 297, Severity 16, State 1, Procedure rbs_fs_sp_check_pool_size, Line 31, Message: The user does not have permission to perform this action.  Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

I have RBS (Remote Blob Storage) enabled for this content database so it appears that, this has got messed up somehow.  After reading various other blog posts and TechNet articles I began some trial and error with the database permissions.

Solution :

So as to resolve this issue we need to grant the service account used by the application pool "db_owner" rights on the content database, in addition to the "db_rbs_* " permissions.

File name invalid or too long

File name invalid or too long

The original error about the filename being too long or invalid is very misleading, there is no hint of a permissions.

Advertisements
Advertisements