1

When creating new database manually in PowerShell using command

New-SPContentDatabase -Name $ContentDatabase -WebApplication $WebApplicationName

it works fine, but recently it has started to fail when it is run as part of nightly build. If I run the exact same scripts manually on the same farm, I get no errors. Error it gives is:

2015-12-08T07:51:03.8157500Z ##[error]New-SPContentDatabase : String or binary data would be truncated.     
2015-12-08T07:51:03.8157500Z ##[error]The statement has been terminated.     
2015-12-08T07:51:03.8157500Z ##[error]At E:\Builds\Plaza for SharePoint\Scripts\50_CreateModuleSiteCollections.ps1:36 char:9     
2015-12-08T07:51:03.8157500Z ##[error]+         New-SPContentDatabase -Name $ContentDatabase -WebApplication $WebApplica ...     
2015-12-08T07:51:03.8157500Z ##[error]+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     
2015-12-08T07:51:03.8157500Z ##[error]    + CategoryInfo          : InvalidData: (Microsoft.Share...ContentDatabase:SPCmdletNewContentDatabase) [New-SPConte      
2015-12-08T07:51:03.8157500Z ##[error]   ntDatabase], SqlException     
2015-12-08T07:51:03.8157500Z ##[error]    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewContentDatabase

In ULS logs it says things like:

System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.  The statement has been terminated.

Unknown SQL Exception 8152 occurred. Additional error information from SQL Server is included below.  String or binary data would be truncated.  The statement has been terminated.

Exception occured during acquiring a server lock. System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.  The statement has been terminated. 

I have all the recent Windows Updates installed to SQL and SharePoint.

Any ideas?

0

1 Answer 1

0

You can try using stsadm.exe instead of New-SPContentDatabase

I had a similar issue and it worked for me.

Example:

& 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN\STSADM.EXE' -o addcontentdb -databasename $dbName -url $webAppUrl

Ref: http://blog.jussipalo.com/2016/02/sharepoint-new-spcontentdatabase-in.html

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.