SharePoint 2010 Search Broken!

Posted: 10th June 2011 in Powershell, Sharepoint 2010, SQL

Okay, so you try to search and your getting dreaded “Internal Server error exception” message seen below. This is not very helpful at all. However, the chances are, your search databases have somehow became corrupt

image

To resolve this, I carried out the following steps.

Note: All of the below assumes that you have called your Search Service Application the default name of Search Service Application

Firstly, you need to delete the SharePoint Search Service Application. You can try doing this from Central Admin, but I found that this just hangs and does nothing. So, in remedy, fire up a SharePoint PowerShell – remembering to run as Administrator (seen below)

image

Once you have PowerShell open you need to find out the ID of Application and delete it.

You can do this in two seperate commands:

Get-SPServiceApplication |?{$_.name -eq "Search Service Application"}

Remove-SPServiceApplication –Identity <ID of Above> –RemoveData

or you can assign it to a variable and do it as one command

$search = Get-SPServiceApplication |?{$_.name -eq "Search Service Application"}
Remove-SPServiceApplication -Identity $search.Id –RemoveData

You should now see the following confirmation.

image

Choose Y to delete it.

Now, just to check that all search references are gone, run the following command

Get-SPDatabase | Where-Object {$_.name -like "Search_Service_Application*"} | select id, Name

You should not have anything returned here, if you have run the command below.

ForEach($db in Get-SPDatabase |  Where-Object  {$_.name -like "Search_Service_Application*"})
{$db.Delete()}

Before going any further you may want to go into SQL Server Management Studio and delete the three orphaned databases created for the search:

Search_Service_Application_CrawlStore_<Guid>
Search_Service_Application_PropertyStore_<Guid>
Search_Service_Application_DB_<Guid>

However, I’ll leave that decision up to you.

After all of the above has been done and you are satisfied that all the references have gone you can now re-configure the Search Service Application as described in the MSDN documentation

Another resource that i have found very helpful is An A-Z Index of Windows PowerShell 2.0 commands

Advertisements
Comments
  1. Dexter says:

    The better way to do this is to just perform an index reset.

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