Rename SharePoint Central Administration Database

Rename SharePoint Central Administration Database

SharePoint uses a series of SQL Server databases to save configuration information, security setups and all the user data that has been created. The Central Administration site is no different and has its own content database that is created when running the SharePoint configuration wizard. Unfortunately, unlike when creating service applications, you do not get to choose the name of this database during the wizard. The database name will default to SharePoint_AdminContent_<_GUID>_. This could be problematic for a number of reasons. Many companies have a set of standards for database names. Other times you will want to change it simply because you have a small OCD issue (that’s me). While the task is not necessarily as easy as going into SQL Server and renaming the database in the object explorer it isn’t necessarily difficult either. Just follow the steps below and you will clear up that OCD (or naming convention) issue in no time. [important]Note these steps should be run from a SharePoint server. You may also need elevated permissions in certain steps to drop databases from the SQL Server.[/important]

  1. Run the SharePoint 2013 Management Shell as Administrator.
  2. Make note of what you would like the new database name to be as well as the current web application name for Central Administration. New Database: SharePointCentralAdmin Web Application: kerberos-sp:36000
  3. With that information run the following command. This will create a new content database named SharePointCentralAdmin in my case. New-SPContentDatabase –Name SharePointCentralAdmin –WebApplication http://kerberos-sp:36000
  4. The next step is to migrate the contents of the previous database (SharePoint_AdminContent_8449cb1b-4a84-4048-9425-0ec6e783ec37) to the new database (SharePointCentralAdmin). To do this we will need to pass database IDs rather than database names to the commands in the next step. To first find the IDs assigned to each of the databases using the Get-SPWebApplication and Get-SPContentDatabase commands. Get-SPWebApplication –Identity http://kerberos-sp:36000 | Get-SPContentDatabase | SELECT ID, Name, WebApplication | Format-List
  5. Make note of the two IDs and which database each belongs to. Original Database: c87506a9-b87d-40b8-9582-aac9ee89c8f8 New Database: f79cb9d8-8e45-4405-82c9-081f58bce7a0
  6. With the IDs in hand use the Get-SPSite and Move-SPSite commands to migrate the content from one database to the other. For each of these commands we need to feed the ID for the database. When running the command you will be prompted to confirm the action, press Y to confirm each prompt or A to accept all the prompts at the beginning. Get-SPSite –ContentDatabase c87506a9-b87d-40b8-9582-aac9ee89c8f8 | Move-SPSite –DestinationDatabase f79cb9d8-8e45-4405-82c9-081f58bce7a0
  7. Note that IIS must be restarted. To do so simply type IISReset into the management shell.
  8. Next, to remove the database association from the Central Administration web application run the following command and press Y to confirm each action. Remove-SPContentDatabase c87506a9-b87d-40b8-9582-aac9ee89c8f8
  9. Optionally confirm the association has been removed by running the same command from Step 4. Get-SPWebApplication –Identity http://kerberos-sp:36000 | Get-SPContentDatabase | SELECT ID, Name, WebApplication | Format-List
  10. Drop the original database with the GUID in the name use SQL Server Management Studio.
  11. Relax because your OCD is now happy. Also go tell the DBAs they owe you a cookie for removing the GUID, they will be happy too.