I found this awesome PowerShell script on Gary LaPointe’s blog and decided to give it a try. This essentially mimics the SharePoint Configuration Wizard, but it gives you the power to use PowerShell! Below are is my experience with this script and how I went about removing the GUIDs from the database names.

Note: This bases the DB Server off of the default DB Server specified in Central Admin (Can be change using PowerShell Later) and it results in databases with GUIDs at the end, but we’ll remove those later :). Obviously change the Managed Account and App Pool names to fit your environment.

This will result in a default topology, but there are GUIDs..yuck! If GUIDs are unacceptable there is a method of renaming Search Service Databases on http://technet.microsoft.com/en-us/library/jj219654.aspx. I went ahead and tried this out.

1. Run the following commands to suspend the search service

2. Now Go into SQL Server Management Studio and set each Search DB to Read-Only Mode (Accept the message to close existing connections). Right Click Database | Properties | Options. Set Read-Only to True

3. Perform a copy-only backup of each Search Database

4. Detach all of the old databases

5. Restore each database backup (Change Restore to File Names so there are no GUIDS in the MDF and LDF files)

6. Right Click Each Database and Rename (Had a pain with Admin DB. I ended up detaching and reattaching with new name)

7. Restore the old databases (Delete MDF and LDF Files first! May need to close out SQL Mgmt Studio).

8. Use PowerShell to point the Search Service Application at the renamed databases

9. Delete the old Databases with GUIDs

Check it out!
clip_image002

 

Edit: As Tuppence pointed out below there is now a way to set this up from the get-go. Check out this link: http://www.funwithsharepoint.com/provision-search-for-sharepoint-foundation-2013-using-powershell-with-clean-db-names/

5 Comments

  1. Pingback: SharePoint 2013 – “2010 Mode” Site Collection Search Scopes | Andrew J Billings

  2. Andrew Billings

    One thing to note – As I was running through this recently. There is no need to detach databases. The backup/restore doesn’t need this. Also, the entries for the crawl and links DB’s aren’t deleted from the config DB. Make sure to get the SPDatabase object and run the Delete() Method on it.

Leave a Reply

Your email address will not be published. Required fields are marked *