Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

Renaming the SharePoint Admin Content Database to Follow SQL Server Naming Conventions


By:   |   Read Comments (16)   |   Related Tips: > Sharepoint

New Whitepaper > 10 Ways We Can Steal Your Data >> download now


Problem

I've been tasked to manage the SharePoint 2010 database server after deployment. While looking at the list of databases, I saw several databases that have GUID values appended to their names, one of them is the SharePoint Admin Content database. How can I rename the database and remove the GUID value from the name?

Solution

In a previous tip, Introduction to SharePoint 2010 for SQL Server DBAs, you were introduced to the different types of databases that SharePoint uses. The SharePoint Central Admin database is a configuration database that stores site content and permissions for the Central Administration web application. As a DBA, we are concerned with backing up and restoring all of the SharePoint databases. While the Central Admin Content database is backed up when a SharePoint farm administrator performs a farm configuration backup, it doesn't get restored when a farm is restored. We can backup and restore the SharePoint Admin Content database separately using native SQL Server backup tools. The challenge here is dealing with a database name that has a GUID value.

Here is an example of the SharePoint database name.

 
the SharePoint Admin Content database

If you have a corporate policy to standardize database naming conventions or use custom database maintenance scripts, it is imperative to rename the SharePoint databases to eliminate those GUID values, starting with the SharePoint Admin Content. While most recommendations will tell you to rename your SharePoint databases accordingly during creation, in most cases, we DBAs are not included as part of the initial planning and deployment process. Thus, we end up with SharePoint databases with such naming conventions. To accomplish this task, we will be using Windows PowerShell via the SharePoint 2010 Management Shell console. Remember to backup the database prior to performing the tasks below.

  1. On the SharePoint web or application server, click Start, point to All Programs, and then click Microsoft SharePoint 2010 Products. In the list of available options, click SharePoint 2010 Management Shell.

    the SharePoint 2010 Management Shell

  2. In the SharePoint 2010 Management Shell, type the following command to create a new content database named SharePoint_AdminContent. This will replace the existing Central Admin content database that has a GUID value in its name. In my environment, the web application name for the SharePoint Central Administration web application is http://sp2010-web1:20376. The New-SPContentDatabase PowerShell cmdlet is described further in this tip on Managing SharePoint Content Databases with PowerShell.

    PS C:\> New-SPContentDatabase -Name SharePoint_AdminContent -WebApplication http://sp2010-web1:20376

    SharePoint_AdminContent.

  3. We need to retrieve the Id values assigned to the SharePoint Admin Content databases. Run the following command, using the Get-SPWebApplication and the Get-SPContentDatabase PowerShell cmdlets.

    PS C:\> Get-SPWebApplication -Identity http://sp2010-web1:20376 | Get-SPContentDatabase | Select Id, Name, WebApplication | Format-List

    the SharePoint Admin Content databases

  4. To move the contents of the SharePoint Admin Content database from the one with the GUID value to the newly created one, run the following command, using the Get-SPSite and the Move-SPSite PowerShell cmdlets. Note that the you should pass the Id property values of the databases names instead of the Name property for the -ContentDatabase parameter of the Get-SPSite cmdlet. Type Y to confirm the prompts.

    PS C:\> Get-SPSite -ContentDatabase 46410944-32c4-4e01-8390-22b693f4fcc2 | Move-SPSite -DestinationDatabase 86d8e579-fbd8-473e-867d-58b974ee0267

    run the following command,

  5. Run IISRESET to restart IIS on the web front end server.
  6. Verify that the SharePoint Central Administration web application renders properly without issues. Try navigating thru the different links to make sure that everything is working fine.
  7. To completely remove the GUID-valued SharePoint Admin Content database, run the following command, using the Remove-SPContentDatabase cmdlet. This will detach the content database from the SharePoint Central Administration web application and eventually deleting it from the SQL Server instance. Type Y to confirm the prompts.

    PS C:\> Remove-SPContentDatabase 46410944-32c4-4e01-8390-22b693f4fcc2

    Run IISRESET to restart IIS on the web front end server

  8. Verify that you no longer have the GUID-valued GUID-valued SharePoint Admin Content database and that it is now using the newly created database

    PS C:\> Get-SPWebApplication -Identity http://sp2010-web1:20376 | Get-SPContentDatabase | Select Id, Name, WebApplication | Format-List

    Verify that you no longer have the GUID-valued GUID-valued SharePoint Admin Content database

    You can also confirm this by checking the list of databases from within SQL Server Management Studio.

    You can also confirm this by checking the list of databases from within SQL Server Management Studio.

In this tip, we've renamed an existing GUID-valued SharePoint content database to remove the GUID value. In future tips, we will look at performing the same task but with the service application databases running on your SharePoint 2010 farm.

Next Steps


Last Update:


signup button

next tip button



About the author
MSSQLTips author Edwin Sarmiento Edwin M Sarmiento is a Microsoft SQL Server MVP and Microsoft Certified Master from Ottawa, Canada specializing in high availability, disaster recovery and system infrastructures.

View all my tips





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Notify for updates 


SQL tips:

*Enter Code refresh code     



Thursday, August 17, 2017 - 1:29:33 PM - Rich Back To Top

Note: If you do it this way then you will lose the WSS_Content_Application_Pools DB role for this database. It is responsible for running certain stored procs involving site maps and the version table.

 


Monday, November 02, 2015 - 11:44:56 PM - vishal Back To Top

Thank you.  I just followed these steps for SharePoint 2013 w/ SQL 2012 Enterprise and it worked perfectly!


Tuesday, February 24, 2015 - 8:50:49 PM - David Back To Top

Great post!  It did exactly what I wanted.  Thank you!


Friday, February 13, 2015 - 2:18:16 PM - Chris Back To Top

I used this today for the MySite DB and it worked.  I tried to follow the link from this post but it's a dead link. 
Are there security issues with this procedure? 

Sunday, February 02, 2014 - 8:04:18 AM - Lewin Wanzer Read The Tip

This isn't supported. There are some security gaps that happen on the database after you update it which cause issues in the farm. http://lewinwanzer.com/renaming-the-central-admin-db-not-supported/


Thursday, October 30, 2014 - 5:31:07 PM - davidh Back To Top

Worked like a charm!!!!


Friday, July 25, 2014 - 11:48:05 AM - bass_player Back To Top

Hi Mathieu and Lewin,

Thanks for raising this concern so that the community will be aware of potential security issues. I have not found any support document about renaming the SharePoint admin content database so the best approach is to contact Microsoft PSS for an official response regarding your specific environment.


Wednesday, July 16, 2014 - 1:49:00 PM - Mathieu Tessier Back To Top

THIS IS NOT SUPPORTED. YOU WILL HAVE SECURITY ISSUES


Sunday, February 02, 2014 - 8:04:18 AM - Lewin Wanzer Back To Top

This isn't supported. There are some security gaps that happen on the database after you update it which cause issues in the farm. http://lewinwanzer.com/renaming-the-central-admin-db-not-supported/


Wednesday, June 12, 2013 - 4:13:14 PM - Sid Helms Back To Top

Edwin,

 

Thank you.  I just followed these steps for SharePoint 2013 w/ SQL 2012 Enterprise and it worked perfectly!

 

-Sid


Wednesday, April 17, 2013 - 10:25:05 AM - bass_player Back To Top

Michael,

I'll write up a tip to rename a SharePoint content database that has a GUID value in it. Thanks for the idea


Tuesday, April 16, 2013 - 4:37:26 PM - Michael Back To Top

Hello Edwin, I want to change the guid of a sharepoint content database.  Have you done that before?


Friday, April 12, 2013 - 5:42:15 AM - dotmit Back To Top

Really handy tip, thanks so much :)


Friday, February 15, 2013 - 8:43:29 AM - Andrew Back To Top

Hi, Edwin
Great article, great experience!

Thanx a lot,
Andrew


Thursday, July 26, 2012 - 6:21:30 AM - Marco Back To Top

hello, also u can a use another process:

use get-SpDatabase to get the guid of the central admin content database

use Dismount-SPContentDatabase

go to sql, put the database in single user mode and rename.

then use Mount-SPContentDatabase-DatabaseServer-WebApplication

 

cheers

Marco Dias


Friday, July 06, 2012 - 7:46:11 AM - Uman Back To Top

Hi Edwin,

Very helpful article. Nice documentation.

Can you please let me know, how to rename BDC database, also the other service application databases like UPS on SP 2010.

Thanks,

Uman


Thursday, June 14, 2012 - 1:22:27 PM - Chuck Back To Top

Hello

Nice article and easy to follow. I tired this out in my dev envoronment and discovered that i could no longer login to the SSRS server that I had integrated.  when I click on the "Reporting Services Integration" link in central administration I see a login failure message. I was able to add the report server again and all seems well.  Thanks for the post. Looking forward to the followup.


Learn more about SQL Server tools