Tuesday, January 18, 2011

SharePoint 2010: Removing GUIDs in Several Service Application Database Names

Introduction

I noticed a few months ago that Shane Young was on a mission to explain how to remove the GUID from the default database names that are generated for each service application in SharePoint 2010. His main post which contains links to specific items is available here.

I luckily ran into several service applications that make it easy to rename the database as a new database is created and configured.

Word Automation Services
This was the first one I found. Using the SharePoint Powershell cmdlet, Set-SPWordConversionServiceApplication allows you to create a new database:

Set-SPWordConversionServiceApplication -Identity "Word Automation Services" -DatabaseServer SP2010\SQLSharePoint -DatabaseName WordServices

Managed Metadata Service
The Managed Metadata Service works the same way:

Set-SPMetadataServiceApplication –Identity “Managed Metadata Service” –DatabaseName TermStoreDB


Business Data Connectivity Service
The BCS works similiar:

$bcs = Get-SPServiceApplication -Identity bc4399ed-a2e0-4397-bf07-cd3d207e630e
Set-SPBusinessDataCatalogServiceApplication –Identity $bcs –DatabaseName BCS_DB

NOTE: You can find the GUID by using Get-SPServiceApplication and finding the BCS Service in the listing.

 

Secure Store Service
The Secure Store Service is similiar yet different. The Set-SPSecureStoreServiceApplication needs the identity of the service application, so you need to get that first:

$sss = Get-SPServiceApplication -Identity bc4399ed-a2e0-4397-bf07-cd3d207e630e
Set-SPSecureStoreServiceApplication –Identity $sss –DatabaseName SecureStoreDB

NOTE: You can find the GUID by using Get-SPServiceApplication and finding the Secure Store Service in the listing.

Here's the tricky part, although the command lines above run and take a few moments to process, the new database is not created. The new database name is set within the properties but SQL Server knows of no such thing. The easy fix here is to view the Secure Store Service Application properties from within Central Admin and click OK. Even though you may not have changed anything from the UI, the database name will be processed and a new database will be created.



Since you need to visit Central Admin anyway, you may just want to skip the PowerShell part and go right into the properties to change the name there.


Conclusion
Each service application has its own way of doing things, however, some make it easy to change the database name and actually create a new instance in SQL Server. Once the new databases are created, you can drop the old databases with the GUID. You may need to restart your servers such that the old databases are no longer in use. If you found this useful, please help support my SharePoint and .NET user group (Philly SNUG) by clicking on the logo below.

Matched Content