Here is a simplified process for restoring an SSA, using a previous SSA Admin DB. For example, if you suspect the current SSA is broken and you want to rebuild the SSA in the same farm. You would restore the original SSA Admin DB with a new name. If you are moving the SSA Admin DB into a new farm, then it would be fine to restore using the same name.
- Restore a backup of your SSA Admin DB.
ex: V7_SSA - Restore to new SQL instance as “V7_SSA” (or a new name if you want\need to, especially if rebuilding the SSA in the same farm)
- Run the following PS to create a new App Pool and Restore the SSA
$appPool = New-SPServiceApplicationPool -Name "Search Service Application" -Account "DOMAIN\v7earch" Restore-SPEnterpriseSearchServiceApplication -Name "V7_SSA" -DatabaseServer SAMURAI -DatabaseName "V7_SSA" -ApplicationPool $appPool -AdminSearchServiceInstance 'server1' - Once this completes, it will create the DBs with the same naming schema of ( instead of providing unwanted, incohesive names )
V7_SSA V7_SSA_CrawlStore V7_SSA_AnalyticsReportingStore V7_SSA_LinksStore - Next, lets provide the SSA a better name (change the SSA name from “V7_SSA” to “Search Service Application” )
$ssa = Get-SPEnterpriseSearchServiceApplication "V7_SSA" $ssa.Name = "Search Service Application" $ssa.SetProperty("DisplayName", "Search_Service_Application") $ssa.Update() - The UI should now show “Search Service Application” instead of “V7_SSA”
- Create a new Proxy for this
New-SPEnterpriseSearchServiceApplicationProxy -SearchApplication "Search Service Application" -Name "Search Service Application" - Next, if you want to add more servers, then you would clone the topology and add more servers\components\index partitionHere is the “base” PS to set Search Instances, Remove\Add components, partitions, etc
$ssa = Get-SPEnterpriseSearchServiceApplication "Search Service Application" ## Set SSI Variables ## $ajcnsv7 = Get-SPEnterpriseSearchServiceInstance "ajcnsv7" $ajcnsv7app = Get-SPEnterpriseSearchServiceInstance "ajcnsv7app" $indexLocation1 = "D:\SearchIndex\SSA" $indexLocation2 = "E:\SearchIndex\SSA" ## Get Active Topology $activeTopo = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active ## Retrieve a list of search components Get-SPEnterpriseSearchComponent -SearchTopology $activeTopo | select ServerName, Name, RootDirectory, IndexPartitionOrdinal | Sort -Property ServerName, IndexPartitionOrdinal | ft -AutoSize ## Clone the Topology $cloneTopo = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $activeTopo ## Remove Stuff If needed ## Remove-SPEnterpriseSearchComponent -Identity AdminComponent2 -SearchTopology $cloneTopo -Confirm:$false Remove-SPEnterpriseSearchComponent -Identity AnalyticsProcessingComponent2 -SearchTopology $cloneTopo -Confirm:$false Remove-SPEnterpriseSearchComponent -Identity CrawlComponent0 -SearchTopology $cloneTopo -Confirm:$false Remove-SPEnterpriseSearchComponent -Identity ContentProcessingComponent2 -SearchTopology $cloneTopo -Confirm:$false Remove-SPEnterpriseSearchComponent -Identity QueryProcessingComponent1 -SearchTopology $cloneTopo -Confirm:$false Remove-SPEnterpriseSearchComponent -Identity IndexComponent1 -SearchTopology $cloneTopo -Confirm:$false Remove-SPEnterpriseSearchComponent -Identity IndexComponent3 -SearchTopology $cloneTopo -Confirm:$false ## Add Stuff ## New-SPEnterpriseSearchAdminComponent -SearchTopology $cloneTopo -SearchServiceInstance $ajcnsv7app New-SPEnterpriseSearchCrawlComponent -SearchTopology $cloneTopo -SearchServiceInstance $ajcnsv7app New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $cloneTopo -SearchServiceInstance $ajcnsv7app New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $cloneTopo -SearchServiceInstance $ajcnsv7app New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $cloneTopo -SearchServiceInstance $ajcnsv7app ## Add Indexer #### The location of the index you defined needs to be created ( empty folders ) on the servers you are running the PS on and the server you are trying to set as an indexer New-SPEnterpriseSearchIndexComponent -SearchTopology $cloneTopo -SearchServiceInstance $ajcnsv7app -IndexPartition 0 -RootDirectory $indexLocation1 New-SPEnterpriseSearchIndexComponent -SearchTopology $cloneTopo -SearchServiceInstance $ajcnsv7app -IndexPartition 1 -RootDirectory $indexLocation2 ## Dump cloned Topo components ## Get-SPEnterpriseSearchComponent -SearchTopology $cloneTopo | select ServerName, Name, RootDirectory, IndexPartitionOrdinal | Sort -Property ServerName, IndexPartitionOrdinal | ft -AutoSize ## Set Cloned Topology as Active Set-SPEnterpriseSearchTopology -Identity $cloneTopo