Clean up – Search Service Application in SharePoint 2013


Well you faced something went wrong and looks that you could not able to delete search service Application correctly. In this article’s purpose  demonstrate which components we have using for a Search Service Application

Ok Lets break our Search Service Application .Well don’t try this on a production 🙂 I assume that you have a completely running Search Service Application and will break it to test purpose
Open a sharepoint powershell console and type

$SSA = Get-SPEnterpriseSearchServiceApplication
(if you have more than one SSA you need to change parameters to get the correct one)
CleanSSA1

So lets create a scenario that someone we assume has deleted our good SSA like

$SSA.Delete()

CleanSSA2

+Upps In this condition you have a big problem. Because deleting the object of the service app itself is not a correct action . It clears the Service Application Object but Search Service Application have many other components (IIS Web Service,Timer Jobs ,DBs etc)  and they are still remains. Unfortunately there is no warning when you did it.
If you really want to remove a Service Application , you have to use Remove-SPServiceApplication cmdlet, not call the related object’s delete method.

So define what is remaining we have to know what components are we installing when you provision a Search Service Application

-We have creating a IIS Web Site under SharePoint Web Services Site.
-We have creating 8 Timer jobs for every SSA.

  • “Search Custom Dictionaries Update for Search Application <guid of SSA>”
  • “Crawl Log Cleanup for Search Application <guid of SSA>”
  • “Rebalance crawl store partitions for <guid of SSA>”
  • “Usage Analytics Timer Job for Search Application <guid of SSA>”
  • “Spelling Customizations Upgrade for Search Application <guid of SSA>”
  • “Spelling Dictionary Update for Search Application <guid of SSA>”
  • “Analytics Timer Job for Search Service Application <guid of SSA>”
  • “Query Classification Dictionary Update for Search Application <guid of SSA>”

-In a usual way we have creating a Search Service Application Proxy
-And that Proxy consumed by several Web Applications .
-And a Search Administration Web Service (We are using this for Crawl operation, Crawl component is not a FAST Search related part and not runs under noderunner.exe process .

Actions:
Well the supported action for this scenario is return from Backup by Microsoft!
But if you want to get a clean state on a test env you may try this;

1) Remove the Search Service DB’s
CleanSSA3
2) Open IIS and find Search Service Related web sites under SharePoint Web Services , locate and delete only the related search service site.
CleanSSA6
3) Clean up all SSA Connections on Web Application level.
-Open the Central Administration -> Manage Web Application -> Select Web Application -> Click to Service Connections on the ribbon
CleanSSA5
4) Remove if SSA Proxy still available
CleanSSA4
5) Remove Search Administration Web Service Application if exists

6) Clear the timer jobs belong to deleted SSA .(Otherwise they will make a log noise with critical exceptions )
(I accept this can create some concequences and you may not able to delete some remaining timer-jobs very easily in some scenarios but at least you can disable them.)
Well totally clear it , you may need to open a case to Microsoft.

Even so there are many objects still remains in SharePoint_Config database. Directly deleting from database is an unsupported operation!

 

Advertisements

About bpostaci
Sr. Support Escalation Engineer in Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: