How to Rename the SharePoint Search Databases

If you have created the SharePoint Search Service Application using the GUI in SharePoint you have probably noticed that it has added some ugly GUIDs on the end of your database names. In this blog post I will show you how to get rid of them.

Renaming the Crawl Store and Property database will be pretty easy but the Admin database will take a little bit of work.

Renaming the Crawl Store and Property database

1.Open Central Administration and go to manage service applications. Now select your Search Service Application and hit manage.

2.At the bottom of the page and click modify in the Search topology Section.

3.Click on the Edit Properties for the crawl database.

4. On the Edit Crawl Database Screen go to the Database Name Field. Here you can highlight the GUID and delete it off the end of your database then click ok.

5. You can now repeat steps 3 and 4 for the property database.

Renaming the Search Admin Database

If you try to edit the Admin database you will notice that it is greyed out and you can't change it using the GUI. In order to change it we will need to use the SQL Server Managment Studio as well as powershell.

1. Open SQL server managment studio and find your search admin database. If you are not sure which one is your admin database you can find it in the Search Service application at the bottom of the page.

2. Back up the admin Database. You can do this by right clicking on the database selecting tasks then Back Up…

3. Now right click on on the Database folder and select Restore Database.

4. In the restore database window select From Device. Then click the radio button and select the backup of the admin database you just made. Now that you have the backup selected enter the new name you would like for the database in the to database field. Now you can click OK then click OK again at the database restored successfully screen.

5. Now get back on the SharePoint server and open the SharePoint Managment Shell as Administrator.

6. Now enter the following line into the PowerShell to set the identity of your Search Service Application:

$searchssa=Get-SPEnterpriseSearchServiceApplication -identity "Your Search Service Application".

7. Next we will want to pause the Search Service Application before we add the database. We will do this with the following PowerShell command:

$searchssa.Pause()

8. Now we are going to add set our newly named database as the Search Admin database. We will do this with the following PowerShell command:

$searchssa | Set-SPEnterpriseSearchServiceApplication -DatabaseName "Your newly named SharePoint Admin DB" -DatabaseServer "Your SQL Server"

9. Now we will want to resume our Search Service Application. We will do this with the following PowerShell command:

$searchssa.Resume()

10. Now go back to your Search Service Application and check your databases. The GUIDS will all be gone.

11. The database may look like it is no longer in SharePoint but if you run the command you will see that it still is:

get-spdatabase | Select Name, ID

12. Mark the ID for the old database from above then run this PowerShell command:

$olddb=get-spdatabase <ID of old DB>

13. Next we want to delete the old database so we will run the PowerShell command:

$olddb.Delete()

14. Now that we have deleted the old admin database from SharePoint the last step is to delete the old database from SQL. To do this we go into SQL Server Managment Studio right click on the old database and select delete.

15. On the next screen check the close existing connections box then click ok.