SharePoint Server Error: “Sorry, something went wrong. There was an exception in the Database”

No comments

How to fix “Sorry, something went wrong. There was an exception in the Database. Please retry your operation and if the problem persists, contact an administrator” in SharePoint 2016 search.

Issue Descriptions:

All of a sudden, our SharePoint 2016 search is not working. From the browser getting the below error:

SorrySomethingWentWrongErrorInSharePointSearch

ULS log report from front end server:

SearchServiceApplicationProxy::IsUrlMappingCachedWithHash–Error occured: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: There was an exception in the Database. Please retry your operation and if the problem presists, contact an administrator. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: Microsoft.Office.Server.Search.Query.Pipeline.SearchObjectDatabaseException: There was an exception in the Database. Please retry your operation and if the problem presists, contact an administrator.
at Microsoft.Office.Server.Search.Query.Pipeline.QueryPipelineErrorHandler.TranslateSqlException(SqlException ex)
at Microsoft.Office.Server.Search.Query.UrlMapping.UrlMappingDatabaseManager.GetUrlMap(Tuple`3 key)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.IsUrlMappingCachedInternal(Guid subscriptionId, SPUrlZone zone, String siteCollectionHash)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.IsUrlMappingCachedWithHash(Guid subscriptionId, SPUrlZone zone, String siteCollectionHash)
at SyncInvokeIsUrlMappingCachedWithHash(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs,…).

ULS log report from application with search server:

System.Data.SqlClient.SqlException (0x80131904): Procedure or function proc_MSS_GetUrlMapping has too many arguments specified.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Office.Server.Data.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock)  ClientConnectionId:92965ffb-2fb0-4b24-8915-6d20c50568a1  Error Number:8144,State:2,Class:16

Analysis (solution):

Run the SharePoint Configuration wizard in Application with search server successfully, then the search starts working as normal.

Notes:

1. To be on safer side, before running the SharePoint Configuration wizard we must take following backups in the server:

  • Take server snapshot or image backup of all servers(including the SQL server) in the farm.
  • Take all service application database backup.
  • Take all content database backup.
  • Take SharePoint_Config database backup.

2. Need to remove the “WSS_UsageApplication” database from availability group:
If you have an availability group in place in the SQL, we need to remove the “WSS_UsageApplication” database (logging database) from availability group otherwise while running the SharePoint configuration wizard will get an error and will not be able to complete the wizard running successfully. And after successfully running the wizard we need to add back the “WSS_UsageApplication” database back to the availability group.