Set Database Names for Search Service Application in SharePoint 2016

Set Database Names for Search Service Application in SharePoint 2016

Unless you script SharePoint installation using AutoSpInstaller or a similar tool, you may not be able to choose database names when creating service applications.

When creating a Search Service Application, 4 databases are created in the background:

  1. Admin database (primary, stores all configuration)
  2. Analytics
  3. Crawl
  4. Links

Changing the names of the search databases is a painstaking process involving shutting down search, detaching the databases and running some Powershell.

If you have the option of blowing away the Search Service Application I recommend the shortcut below..

GUID Suffix

For years SharePoint has made it a standard practice to apply GUID suffixes service application database names when deployed via Central Admin. To avoid a GUID suffix, use PowerShell to create the search service application instead of Central Admin (commands below)

Shortcut

SharePoint 2016 uses a specific naming convention for search databases when you create the service application.

Admin Database:
    <Name of Service Application>
Analytics Database:
    <Name of Service Application>_AnalyticsReportingDB
Crawl Database
    <Name of Service Application>_CrawlDB
Links Database:
    <Name of Service Application>_LinksDB

SharePoint 2016 applies a guid suffix to the search service application databases when provisioned via Central Admin. Provision the search service application via powershell to avoid the guid suffix.

Understanding the naming convention, there may be a way to avoid database renaming entirely by naming the service application in a way that conforms to your naming conventions, and then rename the service application.

Step 1: Create the Service Application

The first step is to create the service application

$appPool = New-SPServiceApplicationPool -name "SsaAppPool" -account contoso\adminUser
$ssa = New-SPEnterpriseSearchServiceApplication -Name "NewSSA" -ApplicationPool $appPool
New-SPEnterpriseSearchServiceApplicationProxy -name "SSA Proxy" -SearchApplication $ssa

This will create the Search Service Application & corresponding databases according to the naming convention above.

Before you can get searching you'll also need to set up a search topology.

Step 2: Rename the Search Service Application

The Powershell command to rename the service application does not involve stopping/restarting the search service:

$ssa = get-SpEnterpriseSearchServiceApplication -identity "<name of ssa>"
$ssa.Name = "<new name of SSA>"
$ssa.Update()

The Search Administration Web Service Application is another service application created when you create an SSA. The name of this service application should automatically update after you change the name of your SSA after an IIS reset.

I tested this with the search service application but the shortcut may apply to others. If you get it working let me know!

Title Image: Wires by Mussi Katz / CC BY 2.0