Rename SharePoint 2010 Central Admin database

I had a post on this for SharePoint 2007 and needed to do the same thing for SharePoint 2010, but wanted to do this the powershell way instead of the stsadm way I used for MOSS. Not sure if that would even work…

turns out I didn’t need to reinvent the weel as Todd Klindt has already blogged about this here

The trick to all this is that for moving all site collections in a content database you would execute Get-SPSite with -contentdatabase parameter to get all the site collections for that content database and then pipe that to a Move-SpSite command. With the Central Admin content database the only way to get the site collections is to specify the GUID of the contentdatabase instead of the database name

In short, here are the commands:

#Create a new Content Database
New-SPContentDatabase -Name SharePoint_CentralAdmin -WebApplication http://sp2010:1000
#Get the Database GUIDs
get-spcontentdatabase -webapplication http://sp2010:1000
Id: d3d04cb1-b919-4262-b2d7-46733ef2c5df
Name : SharePoint_AdminContent_81476219-04f5-46b8-807f-31aa4afb4056
WebApplication : SPAdministrationWebApplication
Server : SP2010-DB
CurrentSiteCount : 2

Id : d8647aed-ef42-4052-814b-670b36fb8c1e
Name : SharePoint_CentralAdmin
WebApplication : SPAdministrationWebApplication
Server : SP2010-DB
CurrentSiteCount : 0

#Move the site collections
Get-SPSite -ContentDatabase d3d04cb1-b919-4262-b2d7-46733ef2c5df | Move-SPSite -DestinationDatabase d8647aed-ef42-4052-814b-670b36fb8c1e

Now do an IISRESET and check that the Central Admin site renders properly. If it does you can safely remove the content database with the GUID in it. Since I check the Central Admin site, I just delete the content database with the GUID from within the Central Admin Site

Leave a Reply

Your email address will not be published. Required fields are marked *