Share via


Rename Central Admin Database in SharePoint 2010 using PowerShell

In SharePoint , databases created by default have GUID as suffix. But sometimes , requirement is such that we do not want GUID in database names. In one of my project also , there was a requirement to rename Central Administration database. There is a step-by-step solution for this :-

1.) Start SharePoint 2010 Management PowerShell.

2.) Type below command to get information about content database being used  by Central Admin

   

     Get -spcontentdatabase  -webapplication <Central Admin Url>

     This command show content database id, name, web application, database server  and count.

     Mark the id of this content database.

 

3.) Now we have to create a new content database to attach with Central Admin, for that type the below command

     New -spcontentdatabase  -name <Database Name>  -webapplication <Central Admin Url>

4.) Again run PowerShell command mentioned in Step 2, this time it will show two content database information, old and new content database.

     Mark the id of new Content database.

5.) To move the site collection from old content database to new content database , type below command in PowerShell

     Move -SPSite -ContentDatabase <old Content DB id> | Move -SPSite -DestinationDatabase  <new Content DB id>

6.) If you run the command in Step 2 , you will see the new content database is attached to Central Admin. Now you can delete the content database from SQL Server Management Studio.

7.) Start SQL Server Management Studio, select the database, right click and select delete. But before pressing OK, select checkbox "Close Existing Connections" and we are done.

     Now we have Central Admin content database name as per our requirement.But if you again run command mentioned in Step 2, you will still find two content database.

     To get rid of this, we have to perform few more steps :-

8.) Start Central Admin -> Application Management -> Manage Content Database.

9.) On Manage Content Database page , select Central Admin Web Application. It will show you two content databases, one with GUID (old) and one without GUID (new).

10.) Click on old Content Database to detach, it will open Manage Content Database Settings page. Select Remove Content Database and click OK

11.) Again if you run PowerShell command in Step 2, now you will get only one Content database  i.e. new Content database with custom name.

     

Hope this is helpful for SharePoint 2010 users.