You may have a stale database try:
Get-SPDatabase | where {$_.name -like "*Search*"}
The above will get you all of your search databases, get the GUID of the database you want to delete:
PS C:\> $db = Get-SPDatabase | where {$_.ID -eq "GUID"} PS C:\> $db.Delete()
Hi,
Have you tried to remove the Search Service from Centeral Administration page?
I have tried to remove through CA. And it throws an error (not at machine to take screen shot). The error is essentially saying "the account contoso\sp.admin is unable to login to the database SP2013_SearchService" and they refuses to remove service.
It can't login because it no longer exists.
Have you tried to remove it using Powershell?
Verify that you meet the following minimum requirements:
-
You must have membership in the securityadmin fixed server role on the SQL Server instance
-
You must have membership in the db_owner fixed database role on all databases that are to be updated.
-
You must be a member of the Administrators group on the server on which you are running the Windows PowerShell cmdlet.
$spapp = Get-SPServiceApplication -Name "<Service application display name>"
Remove-SPServiceApplication $spapp
Remove-SPServiceApplication $spapp -RemoveData
The last line removes the databases!
When I run Get-SPServiceApplication
Enterprise Search service is listed.
When I run
Get-SPServiceApplication | ?{$_.TypeName -like "*search*"}
I get:
format-default : Exception has been thrown by the target of an invocation.
+ CategoryInfo : NotSpecified: (:) [format-default], TargetInvoca
tionException
+ FullyQualifiedErrorId : System.Reflection.TargetInvocationException,Micr
osoft.PowerShell.Commands.FormatDefaultCommand
So I can't get a handle on it to delete it.
Hi again,
Have you tried to Clean the configuration cache and try again?
Dear,
did you already tried this:
$ssa = Get-SPEnterpriseSearchServiceApplication -id <GUID of your Search> $ssa.unprovision(1)
and if this doesn't work you can replace the last line with
$ssa.Delete()
Hi,
I have recreated your scenario and succeded to delete the search service application. Just follow the steps that I provided to you!
Get-SPServiceApplication
Identify the Guid of your search application
$P = Get-SPServiceApplication -identity PutYourSearchApplicationGuidHere
Remove-SPServiceApplication $p
Remove-SPServiceApplication $p -RemoveData