How to Rename SharePoint 2013 Central Admin Database to Remove GUID?

When you run the SharePoint products configuration wizard right after installing SharePoint binaries, it creates a SharePoint central administration database with GUIDs. E.g. SharePoint_AdminContent_a149fa83-d2b9-4ad9-9e4c-ad12f73f0dd6.

Your DBA’s may not be happy with these GUIDs as they deviate from database naming standards. So, let’s rename the SharePoint Central administration content database with the following steps:

sharepoint admin content database guid
Always, remember to back up SharePoint Central Admin database prior to performing these steps.

Here is how to remove GUID from SharePoint 2013 Central Admin database in three simple steps:

Step 1. Detach Central Admin Content Database:

Detach Central Admin Content Database: (PowerShell: Dismount-SPContentDatabase)

stsadm -o deletecontentdb -url http://centraladmin:2013 -databasename SharePoint_AdminContent_a149fa83-d2b9-4ad9-9e4c-ad12f73f0dd6 -databaseserver SP13_SQL

Step 2. Rename the Content Database from SQL Server

Right-click the database, Choose Properties, Select Options tab. Set the Database restricted access property to “Single User Mode”. Rename the Database by removing GUID from it (Right-click the database, choose “Rename”). Now, set the database restricted access back to “Multi-User”.
sharepoint 2013 database names guid

Step 3. Attach the renamed Content Database

Attach the renamed content database back to Central Administration web application: (PowerShell: Mount-SPContentDatabase)

stsadm -o addcontentdb -url http://centraladmin:2013 -databasename SharePoint_AdminContent 

How to Rename SharePoint 2013 Central Admin Database to Remove GUID?

An alternate approach to rename the SharePoint database:

Alternatively, You can create a new content database with the right naming conventions, move all sites from the existing content database to the new database, and then get rid of the old database. Here is the script:

#Create new Content Database
New-SPContentDatabase -Name SharePoint_AdminContent -WebApplication http://centraladmin:2013

Now the Central Admin should have two databases attached with it.

sharepoint admin content database guid

Let’s get the IDs of those two databases:

# Get SharePoint database IDs for old and new DBs for central admin site
Get-SPWebApplication -Identity http://centraladmin:2013 | Get-SPContentDatabase | SELECT ID, Name, WebApplication | Format-List

#Note down the IDs of Original Database and New Database. 
# In my case, Old database id: c87506a9-b87d-40b8-9582-aac9ee89c8f8.  
# New Database id: 8f35dc3b-56ab-45df-a1cf-459b60aa7454
rename sharepoint central administration database

Now, Lets move all sites from Old database to New Database:

# Move central admin sites to from old Database to new SharePoint content database
Get-SPSite -ContentDatabase c633c573-966d-4362-a1f8-430fba561f11 | Move-SPSite -DestinationDatabase 8f35dc3b-56ab-45df-a1cf-459b60aa7454

#You must do an IISReset!
IISReset
# Now, You can Remove OLD SharePoint admin content database using Old database ID - actually deletes the database on the SQL Server.
 Remove-SPContentDatabase -identity c633c573-966d-4362-a1f8-430fba561f11 

How to Avoid GUIDs in SharePoint Databases?
Prevention is better than cure! Always use PowerShell to avoid GUIDs in SharePoint Databases. Do not run the Products configuration wizard right after installation. Use PowerShell to create the SharePoint farm and service applications How to Create a SharePoint 2013 Farm using PowerShell?

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply