4

I am unable to remove a search service application from SharePoint 2013 standard edition farm. I do not fully know what caused it to get into this state, but where it is at is this:

  • Search is "Paused: for external" - this was done while applying a CU
  • There is no active topology - I am thinking this occurred when attempts were made to remove the search service and they failed

This causes the situation that I can't unpause the search because there is not active topology to go to and I can't activate a topology because it is paused.

At this point, I just want to remove the search service completely and rebuild it, but it times out on delete. I have used the UI, I have used Power shell, etc. I have done IIS resets, config cache rebuilds, IIS resets.

I have also not been able to reproduce the exact same situation on my test environment at all.

2 Answers 2

8

I ended up contacting MS support of to assist with resolution. The root cause was the timer service "instance" was offline on the server. Since there was only one server in farm, timer jobs no longer ran. The timer service (windows service) itself was running, but the service instance (Farm level on server) was not.

This was found by running the following commands:

$farm = Get-SPFarm
$disabledTimers = $farm.TimerService.Instances | where {$_.Status -ne "Online"}

After that was ran, then we cold use the following commands to change it back to "online"

if ($disabledTimers -ne $null)
{
foreach ($timer in $disabledTimers)
{
Write-Host "Timer service instance on server " $timer.Server.Name " is not Online. Current status:" $timer.Status
Write-Host "Attempting to set the status of the service instance to online"
$timer.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online
$timer.Update()
}
}
else
{
Write-Host "All Timer Service Instances in the farm are online! No problems found"
}

This then allowed the timer jobs to then run. Of course by this time, the One-Once jobs were backlogged and since they did not complete, they did not clean themselves up.

Ran:

Get-SPTimerJob | ?{$_.schedule.description -eq "One-time"} |select displayname,server,locktype,lastruntime | fl

I then just ran to clean up:

$job = Get-SPTimerJob | ?{$_.schedule.description -eq "One-time"}
$job[0].Delete()

After that was completed, I was able to remove he search service and get everything back to running normal.

Note: (I am not sure if it was part of cause, or a result of troubleshooting but the exact same error was replicated in my test environment when I validated these steps) We found that the Job definitions page gave an "object reference not set to an instance of an object" error after that point. I found this article to finish the clean up: http://sharepointviews.com/review-job-definitions-page-error/

This basically consisted of the following commands:

Get-SPTimerJob | ? { $_.DisplayName -eq $null }| select name, Id
$FaultyJob = Get-SPTimerJob <Guid of the job>
$Faultyjob.Delete()

I hope that at least some of this can help someone else that may be struggling.

1
  • thank you ! that solved the timeout error i had when deleting / creating managed metadata service. After that script I had to reboot to get everything storted ! Time SAVER THX
    – Jeff
    Commented Jul 15, 2019 at 8:43
0

I have been in this situation before and my suspect is related with your Timer job service. It is recommended you need to suspend Search Service application using below before you install CU update otherwise your search might get corrupted.

$ssa = Get-SPEnterpriseSearchServiceApplication -Identity Search Service Application 
Suspend-SPEnterpriseSearchServiceApplication -Identity $ssa

The following steps hopefully resolve your issue

You might want to try clear configuration cache

use the powershell script in link below: https://gallery.technet.microsoft.com/office/Clear-Configuration-Cache-d55bcba9

Remove search again using powershell.

 $P = Get-SPServiceApplication -identity [GUID of Search Service Application]
 Remove-SPServiceApplication $P -RemoveData

STSADM command if Powershell above not working

 stsadm -o deleteconfigurationobject -id [replace with GUID of enterprise search]

Note: Deleting using stsadm command above, you might need to remove SearchDB and Search Application Pool manually.

It also worth to check if there is an OrphanDB using the following code

$OrphanDBs = Get-SPDatabase | Where {$_.Exists -eq $false}
#clean any Orphans DB
Get-SPDatabase | Where{$_.Exists -eq $false} | ForEach {$_.Delete()}

Once Search service deleted, i have come another problem where i always get timeout when creating Search service either using powershell or Central admin GUI. Then i decide to remove the server from the farm and then rejoin the farm which reinstall the services.

5
  • I agree that it is most likely related to the timer service. I have found that the client changed the account the timer service runs as from the "farm account" to the "install account" (not sure why and client does not remember why). I have since changed it back to the original farm account. I have attempted all of the items listed above (as well as changing the farm account to be a sysadmin in the database thinking maybe they played with security there also), but still have no solution. Commented Nov 13, 2017 at 20:47
  • If you have more than one server, remove the server from the farm. Assign another server to host Central Admin. Try to delete the Search from Manage Service application again.
    – Supermode
    Commented Nov 14, 2017 at 4:05
  • unfortunately they only have one server in farm :). I may have to stand up a new server join farm and then remove old server and join it back, then remove second server from farm.... but that will get messy. Commented Nov 15, 2017 at 14:20
  • Try to resume $ssa = Get-SPEnterpriseSearchServiceApplication "Search Service Application" then Resume-SPEnterpriseSearchServiceApplication -Identity $ssa. It should not take more 5 minutes to resume the services
    – Supermode
    Commented Nov 21, 2017 at 5:05
  • Thank you for the input. That has been tried... it never completes. Looking at the logs the statement is repeated "Waiting for RemoveAllNodes job to finish" every 1 minute (may not be exact message, I don't have it right in front of me.) Commented Nov 22, 2017 at 14:25

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.